跳转到内容
项目模板·Pro

Markdown 静态网站

用 Markdown 写页面,再构建成带统一布局和菜单的静态 HTML 网站。构建脚本约 110 行 Node.js,可以随意修改,唯一的依赖是 marked。在 DevBrowser 中打开结果。首次 npm install 需要 Linux 环境。

安装它需要 PocketCode Pro。

如果你的 Android 设备上装了 PocketCode,这会在应用里打开此页面。

预览

文件

README.md
build.js
content/about.md
content/guide.md
content/index.md
lib/site.js
package-lock.json
package.json
static/style.css
templates/layout.html
test/site.test.js

README.md

# Markdown site: static pages built with Node.js Write pages in Markdown and turn them into a small static site: every file in `content/` becomes an HTML page with the same layout and a menu that links them all. `build.js` and `lib/site.js` add up to about 110 lines you can read and change, and the only package is [marked](https://marked.js.org), the Markdown parser. The output is plain HTML and CSS, with no JavaScript, so it works on any static host. Comes with tests. ## Run it in PocketCode 1. Install marked once. Open the terminal in this project's folder (Open Terminal Here, in the editor menu) and run this in the app's Linux environment with Node.js and npm (the Developer pack in Terminal › Linux); it needs internet: ```sh npm install ``` 2. Build the site: open `build.js` and tap Run, or in the terminal: ```sh npm run build ``` The output lists the pages it wrote to `site/`. 3. Open `site/index.html` in the editor and tap the DevBrowser button to see it. The menu links work between pages. After you edit a Markdown file, build again and reload the DevBrowser. In the terminal, `npm run watch` builds again on every save. ## Add a page Create a file in `content/`, for example `content/projects.md`: ```markdown --- title: Projects order: 3 --- # Projects What I am working on. See the [about page](about.md). ```

此预览已截短。安装后可获得完整内容。

1.0.0 的变更

首个版本。

相关

无依赖的 Node.js JSON APIPro项目模板基于 node:http 的笔记 API:创建、列出、修改、删除,带输入校验和 JSON 错误信息,数据保存到文件。无需安装任何东西:在 server.js 上点 Run,应用自带的 Node.js 会在 localhost:3000 启动它。附带测试。Express + SQLite 任务 APIPro项目模板基于 Express 5 的任务 API,支持筛选、分页并附带测试。数据存入 node:sqlite,无需编译原生模块。需要带 Node.js 22.13 或更新版本的 Linux 环境;npm install 约下载 3.5 MB。纯 JavaScript 待办清单Pro项目模板用纯 JavaScript 模块写的待办清单:添加、原地编辑、勾选、筛选、清除已完成,数据保存在 localStorage。逻辑部分带有 Node 内置测试运行器的测试。在 DevBrowser 和应用自带的 Node.js 中运行,不需要 Linux。静态落地页Pro项目模板纯 HTML 和 CSS 编写的单页网站:带折叠菜单的页头、首屏、功能网格、常见问题和页脚。颜色跟随系统的浅色或深色模式。无需构建,也不需要 Linux:打开 index.html,点地球图标即可。Next.js + Tailwind + i18nPro项目模板Next.js 15 项目,带 next-intl 和 Tailwind CSS,在 /en 和 /es 提供一个英语和西班牙语页面。深色模式跟随系统。需要带 Node.js 的 Linux 环境;首次 npm install 约下载 400 MB。Flask + SQLite 网页应用Pro项目模板用 Flask 写的阅读清单:服务端渲染页面和普通表单,数据存入 SQLite,另有一个小型 JSON API。测试使用 Flask 的测试客户端。需要 Linux 环境中的 Python 和 pip,会安装 7 个固定版本的包。