zengen 0.1.35 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/.github/workflows/bump-version.yml +112 -0
  2. package/.github/workflows/ci.yml +2 -2
  3. package/.github/workflows/pages.yml +1 -7
  4. package/.zen/meta.json +155 -0
  5. package/.zen/src/en-US/01d04f7c17b4a541ead9d759d877b30b403e15b849182a49eb1f62bd29ecd18c.md +120 -0
  6. package/.zen/src/en-US/1b798c44a4f353e47296ca83d5905e37e6aba3e90bbd9bc3b3d34fc12059a2ca.md +75 -0
  7. package/.zen/src/en-US/1e96be58d76c60056b708eb5bd8b8b81d7b5845d9cfe0b879d85068a5f11df3a.md +189 -0
  8. package/.zen/src/en-US/5ec990146b35e00de2630559126ee07f7cdcddeb23b0e8cab3d85b4181353e26.md +53 -0
  9. package/.zen/src/en-US/6124ea88edec5bde737b26b21f71ecfeffe4e73151784856edf813ee231a4baa.md +11 -0
  10. package/.zen/src/en-US/80ae9bed74fc6348a7c1fe9f33e86b65f5d919169721f77bcf0e1bc29fbdb4f9.md +61 -0
  11. package/.zen/src/en-US/f0c2799126931ccd113a0c45b1e623870b0d4f4f400becf6dd877da8f1011517.md +41 -0
  12. package/.zen/src/en-US/fdfca9b960d0eaa8b2b96fe988ead7481d2c0b16f66ebc94fb477139b4178cdc.md +65 -0
  13. package/.zen/src/zh-Hans/01d04f7c17b4a541ead9d759d877b30b403e15b849182a49eb1f62bd29ecd18c.md +120 -0
  14. package/.zen/src/zh-Hans/1b798c44a4f353e47296ca83d5905e37e6aba3e90bbd9bc3b3d34fc12059a2ca.md +77 -0
  15. package/.zen/src/zh-Hans/1e96be58d76c60056b708eb5bd8b8b81d7b5845d9cfe0b879d85068a5f11df3a.md +189 -0
  16. package/.zen/src/zh-Hans/5ec990146b35e00de2630559126ee07f7cdcddeb23b0e8cab3d85b4181353e26.md +55 -0
  17. package/.zen/src/zh-Hans/6124ea88edec5bde737b26b21f71ecfeffe4e73151784856edf813ee231a4baa.md +1 -0
  18. package/.zen/src/zh-Hans/6ad8db715a1b60613fe934fefb29fa981ecad9b63145593accff144d73b44bde.md +175 -0
  19. package/.zen/src/zh-Hans/80ae9bed74fc6348a7c1fe9f33e86b65f5d919169721f77bcf0e1bc29fbdb4f9.md +63 -0
  20. package/.zen/src/zh-Hans/a1580f71c6c6c1ff4a314be72d410a8507af2f087d56360c7f5048d349c21953.md +48 -0
  21. package/.zen/src/zh-Hans/d49012f98c4367b34034063400e2f7826bf0615952210c82396920172d468e2c.md +107 -0
  22. package/.zen/src/zh-Hans/f0c2799126931ccd113a0c45b1e623870b0d4f4f400becf6dd877da8f1011517.md +41 -0
  23. package/.zen/src/zh-Hans/fdfca9b960d0eaa8b2b96fe988ead7481d2c0b16f66ebc94fb477139b4178cdc.md +65 -0
  24. package/assets/templates/default/layout.html +274 -0
  25. package/dist/ai/extractMetadataFromMarkdown.d.ts +8 -0
  26. package/dist/ai/extractMetadataFromMarkdown.d.ts.map +1 -0
  27. package/dist/ai/extractMetadataFromMarkdown.js +88 -0
  28. package/dist/ai/extractMetadataFromMarkdown.js.map +1 -0
  29. package/dist/ai/translateMarkdown.d.ts +8 -0
  30. package/dist/ai/translateMarkdown.d.ts.map +1 -0
  31. package/dist/ai/translateMarkdown.js +29 -0
  32. package/dist/ai/translateMarkdown.js.map +1 -0
  33. package/dist/build/pipeline.d.ts +6 -0
  34. package/dist/build/pipeline.d.ts.map +1 -0
  35. package/dist/build/pipeline.js +218 -0
  36. package/dist/build/pipeline.js.map +1 -0
  37. package/dist/cli.js +17 -83
  38. package/dist/cli.js.map +1 -1
  39. package/dist/findEntries.d.ts +10 -0
  40. package/dist/findEntries.d.ts.map +1 -0
  41. package/dist/findEntries.js +38 -0
  42. package/dist/findEntries.js.map +1 -0
  43. package/dist/index.d.ts +1 -32
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +1 -35
  46. package/dist/index.js.map +1 -1
  47. package/dist/metadata.d.ts +14 -0
  48. package/dist/metadata.d.ts.map +1 -0
  49. package/dist/metadata.js +78 -0
  50. package/dist/metadata.js.map +1 -0
  51. package/dist/paths.d.ts +6 -0
  52. package/dist/paths.d.ts.map +1 -0
  53. package/dist/paths.js +10 -0
  54. package/dist/paths.js.map +1 -0
  55. package/dist/process/extractMetadataByAI.d.ts +5 -0
  56. package/dist/process/extractMetadataByAI.d.ts.map +1 -0
  57. package/dist/process/extractMetadataByAI.js +31 -0
  58. package/dist/process/extractMetadataByAI.js.map +1 -0
  59. package/dist/process/template.d.ts +5 -0
  60. package/dist/process/template.d.ts.map +1 -0
  61. package/dist/process/template.js +188 -0
  62. package/dist/process/template.js.map +1 -0
  63. package/dist/scan/files.d.ts +7 -0
  64. package/dist/scan/files.d.ts.map +1 -0
  65. package/dist/scan/files.js +54 -0
  66. package/dist/scan/files.js.map +1 -0
  67. package/dist/services/openai.d.ts +41 -0
  68. package/dist/services/openai.d.ts.map +1 -0
  69. package/dist/services/openai.js +54 -0
  70. package/dist/services/openai.js.map +1 -0
  71. package/dist/types.d.ts +26 -46
  72. package/dist/types.d.ts.map +1 -1
  73. package/dist/utils/convertMarkdownToHtml.d.ts +7 -0
  74. package/dist/utils/convertMarkdownToHtml.d.ts.map +1 -0
  75. package/dist/utils/convertMarkdownToHtml.js +39 -0
  76. package/dist/utils/convertMarkdownToHtml.js.map +1 -0
  77. package/dist/utils/frontmatter.d.ts +6 -0
  78. package/dist/utils/frontmatter.d.ts.map +1 -0
  79. package/dist/utils/frontmatter.js +22 -0
  80. package/dist/utils/frontmatter.js.map +1 -0
  81. package/docs/advanced-usage.md +39 -0
  82. package/docs/deployment/github-pages.md +1 -2
  83. package/docs/getting-started.md +26 -0
  84. package/docs/guides/best-practices.md +4 -117
  85. package/docs/guides/config.md +0 -238
  86. package/package.json +5 -2
  87. package/src/ai/extractMetadataFromMarkdown.ts +95 -0
  88. package/src/ai/translateMarkdown.ts +29 -0
  89. package/src/build/pipeline.ts +211 -0
  90. package/src/cli.ts +18 -94
  91. package/src/findEntries.ts +37 -0
  92. package/src/index.ts +1 -40
  93. package/src/metadata.ts +44 -0
  94. package/src/paths.ts +7 -0
  95. package/src/process/extractMetadataByAI.ts +29 -0
  96. package/src/process/template.ts +201 -0
  97. package/src/scan/files.ts +17 -0
  98. package/src/services/openai.ts +92 -0
  99. package/src/types.ts +29 -47
  100. package/src/utils/convertMarkdownToHtml.ts +32 -0
  101. package/src/utils/frontmatter.ts +18 -0
  102. package/test-multilang.js +44 -0
  103. package/dist/builder.d.ts +0 -46
  104. package/dist/builder.d.ts.map +0 -1
  105. package/dist/builder.js +0 -443
  106. package/dist/builder.js.map +0 -1
  107. package/dist/gitignore.d.ts +0 -40
  108. package/dist/gitignore.d.ts.map +0 -1
  109. package/dist/gitignore.js +0 -184
  110. package/dist/gitignore.js.map +0 -1
  111. package/dist/gitignore.test.d.ts +0 -2
  112. package/dist/gitignore.test.d.ts.map +0 -1
  113. package/dist/gitignore.test.js +0 -244
  114. package/dist/gitignore.test.js.map +0 -1
  115. package/dist/markdown.d.ts +0 -30
  116. package/dist/markdown.d.ts.map +0 -1
  117. package/dist/markdown.js +0 -199
  118. package/dist/markdown.js.map +0 -1
  119. package/dist/navigation.d.ts +0 -46
  120. package/dist/navigation.d.ts.map +0 -1
  121. package/dist/navigation.js +0 -196
  122. package/dist/navigation.js.map +0 -1
  123. package/dist/template.d.ts +0 -29
  124. package/dist/template.d.ts.map +0 -1
  125. package/dist/template.js +0 -385
  126. package/dist/template.js.map +0 -1
  127. package/docs/ci/github-ci-cd.md +0 -127
  128. package/docs/guides/api.md +0 -277
  129. package/src/builder.ts +0 -458
  130. package/src/gitignore.test.ts +0 -253
  131. package/src/gitignore.ts +0 -173
  132. package/src/markdown.ts +0 -184
  133. package/src/navigation.ts +0 -237
  134. package/src/template.ts +0 -365
@@ -0,0 +1,112 @@
1
+ name: Bump Version
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version:
7
+ description: 'Version bump type'
8
+ required: true
9
+ type: choice
10
+ options:
11
+ - major
12
+ - minor
13
+ - patch
14
+ default: 'patch'
15
+
16
+ jobs:
17
+ bump-version:
18
+ runs-on: ubuntu-latest
19
+ permissions:
20
+ contents: write
21
+ pull-requests: write
22
+ steps:
23
+ - name: Checkout repository
24
+ uses: actions/checkout@v4
25
+ with:
26
+ fetch-depth: 0
27
+ token: ${{ secrets.GITHUB_TOKEN }}
28
+ persist-credentials: true
29
+
30
+ - name: Setup Git
31
+ run: |
32
+ git config --global user.name 'github-actions[bot]'
33
+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
34
+
35
+ - name: Sync with remote
36
+ run: |
37
+ git fetch origin
38
+ git checkout -b bump-version-${{ github.run_id }}
39
+ git reset --hard origin/main
40
+
41
+ - name: Setup Node.js
42
+ uses: actions/setup-node@v4
43
+ with:
44
+ node-version: '24.x'
45
+
46
+ - name: Get current version
47
+ id: get_version
48
+ run: |
49
+ CURRENT_VERSION=$(jq -r '.version' package.json)
50
+ echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
51
+ echo "Current version: $CURRENT_VERSION"
52
+
53
+ - name: Bump version
54
+ id: bump_version
55
+ run: |
56
+ # 解析当前版本号 (支持 semver 格式)
57
+ CURRENT_VERSION="${{ steps.get_version.outputs.current_version }}"
58
+ echo "Current version: $CURRENT_VERSION"
59
+
60
+ # 使用 npm version 命令来安全地更新版本
61
+ # 这会自动处理 semver 规则
62
+ npm version "${{ github.event.inputs.version }}" --no-git-tag-version
63
+
64
+ # 获取新版本
65
+ NEW_VERSION=$(jq -r '.version' package.json)
66
+ echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
67
+ echo "New version: $NEW_VERSION"
68
+
69
+ - name: Install dependencies
70
+ run: npm ci
71
+
72
+ - name: Run tests
73
+ run: |
74
+ npm run test:types
75
+ npm run test:build
76
+ npm run test:cli
77
+
78
+ - name: Show changed files
79
+ run: |
80
+ echo "Changed files:"
81
+ git status --porcelain
82
+
83
+ - name: Create Pull Request
84
+ uses: peter-evans/create-pull-request@v4
85
+ with:
86
+ commit-message: "chore: bump version from ${{ steps.get_version.outputs.current_version }} to ${{ steps.bump_version.outputs.new_version }}"
87
+ title: "chore: bump version from ${{ steps.get_version.outputs.current_version }} to ${{ steps.bump_version.outputs.new_version }}"
88
+ body: |
89
+ This PR was automatically created by the Bump Version workflow.
90
+
91
+ ## Changes
92
+ - Bumped version from **${{ steps.get_version.outputs.current_version }}** to **${{ steps.bump_version.outputs.new_version }}**
93
+ - Version bump type: **${{ github.event.inputs.version }}**
94
+
95
+ ## Test Results
96
+ - Type checking: ✅ Passed
97
+ - Build test: ✅ Passed
98
+ - CLI test: ✅ Passed
99
+
100
+ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
101
+
102
+ Co-Authored-By: Claude <noreply@anthropic.com>
103
+ branch: bump-version-${{ github.run_id }}
104
+ base: main
105
+ labels: |
106
+ automated-pr
107
+ version-bump
108
+ enhancement
109
+ token: ${{ secrets.GITHUB_TOKEN }}
110
+ add-paths: |
111
+ package.json
112
+ package-lock.json
@@ -11,7 +11,7 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- node-version: [20.x, 22.x, 24.x]
14
+ node-version: [22.x, 24.x]
15
15
 
16
16
  steps:
17
17
  - name: Checkout repository
@@ -52,7 +52,7 @@ jobs:
52
52
  - name: Setup Node.js
53
53
  uses: actions/setup-node@v4
54
54
  with:
55
- node-version: '20.x'
55
+ node-version: '22.x'
56
56
 
57
57
  - name: Install dependencies
58
58
  run: npm ci
@@ -33,15 +33,9 @@ jobs:
33
33
  node-version: '24.x'
34
34
  cache: 'npm'
35
35
 
36
- - name: Install dependencies
37
- run: npm ci
38
-
39
- - name: Build zengen
40
- run: npm run build
41
-
42
36
  - name: Create documentation site
43
37
  run: |
44
- npx --no-install zengen build --base-url /ZEN
38
+ npx zengen@latest build --base-url /ZEN --lang zh-Hans --lang en-US
45
39
 
46
40
  - name: Setup Pages
47
41
  uses: actions/configure-pages@v4
package/.zen/meta.json ADDED
@@ -0,0 +1,155 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "options": {
4
+ "verbose": true,
5
+ "langs": ["zh-Hans", "en-US"]
6
+ },
7
+ "files": [
8
+ {
9
+ "hash": "1b798c44a4f353e47296ca83d5905e37e6aba3e90bbd9bc3b3d34fc12059a2ca",
10
+ "path": "README.md",
11
+ "metadata": {
12
+ "title": "ZEN - Markdown 文档站点构建工具",
13
+ "summary": "ZEN 是一个极简的静态站点生成工具,专注于将 Markdown 文件夹构建为 HTML 站点,支持智能导航和 AI 驱动的增量翻译,强调内容优先和跨语言支持,无需复杂配置。",
14
+ "tags": ["Markdown", "静态站点生成", "AI 翻译", "极简主义", "多语言", "文档工具", "ZEN"],
15
+ "inferred_lang": "zh-Hans",
16
+ "tokens_used": {
17
+ "prompt": 650,
18
+ "completion": 124,
19
+ "total": 774
20
+ }
21
+ },
22
+ "lastUpdated": "2026-01-05T17:52:25.773Z"
23
+ },
24
+ {
25
+ "hash": "5ec990146b35e00de2630559126ee07f7cdcddeb23b0e8cab3d85b4181353e26",
26
+ "path": "docs/advanced-usage.md",
27
+ "metadata": {
28
+ "title": "ZEN 高级用法指南",
29
+ "summary": "本文档介绍了 ZEN 的高级功能,包括自定义 HTML 模板、配置选项(如源目录、输出目录、模板、基础 URL 和多语言支持)以及插件系统,帮助用户扩展和定制 ZEN 工具。",
30
+ "tags": ["ZEN", "高级用法", "自定义模板", "配置选项", "插件系统", "文档生成", "多语言支持"],
31
+ "inferred_lang": "zh-Hans",
32
+ "tokens_used": {
33
+ "prompt": 464,
34
+ "completion": 120,
35
+ "total": 584
36
+ }
37
+ },
38
+ "lastUpdated": "2026-01-05T17:52:30.439Z"
39
+ },
40
+ {
41
+ "hash": "f0c2799126931ccd113a0c45b1e623870b0d4f4f400becf6dd877da8f1011517",
42
+ "path": "docs/getting-started.md",
43
+ "metadata": {
44
+ "title": "快速开始指南",
45
+ "summary": "本文档介绍了ZEN文档生成器的快速入门方法,包括安装步骤、基本使用流程和主要特性,帮助用户快速上手。",
46
+ "tags": [
47
+ "ZEN文档生成器",
48
+ "快速开始",
49
+ "安装",
50
+ "基本用法",
51
+ "特性",
52
+ "Markdown",
53
+ "AI辅助",
54
+ "多语言支持"
55
+ ],
56
+ "inferred_lang": "zh-Hans",
57
+ "tokens_used": {
58
+ "prompt": 373,
59
+ "completion": 102,
60
+ "total": 475
61
+ }
62
+ },
63
+ "lastUpdated": "2026-01-05T17:52:38.265Z"
64
+ },
65
+ {
66
+ "hash": "fdfca9b960d0eaa8b2b96fe988ead7481d2c0b16f66ebc94fb477139b4178cdc",
67
+ "path": "docs/guides/index.md",
68
+ "metadata": {
69
+ "title": "ZEN 文档站点示例",
70
+ "summary": "介绍 ZEN 文档构建工具,一个极简主义的 Markdown 文档站点生成器,包括特性如极简配置、内容优先、智能导航和多语言支持,以及快速开始指南和代码示例。",
71
+ "tags": [
72
+ "ZEN",
73
+ "文档构建工具",
74
+ "Markdown",
75
+ "站点生成器",
76
+ "极简主义",
77
+ "快速开始",
78
+ "多语言支持"
79
+ ],
80
+ "inferred_lang": "zh-Hans",
81
+ "tokens_used": {
82
+ "prompt": 567,
83
+ "completion": 119,
84
+ "total": 686
85
+ }
86
+ },
87
+ "lastUpdated": "2026-01-05T17:52:50.656Z"
88
+ },
89
+ {
90
+ "hash": "6124ea88edec5bde737b26b21f71ecfeffe4e73151784856edf813ee231a4baa",
91
+ "path": "docs/testing/test-document.md",
92
+ "metadata": {
93
+ "title": "Test Document",
94
+ "summary": "这是一个测试文档,内容为空,仅包含标题。",
95
+ "tags": ["测试", "文档", "示例"],
96
+ "inferred_lang": "en-US",
97
+ "tokens_used": {
98
+ "prompt": 265,
99
+ "completion": 58,
100
+ "total": 323
101
+ }
102
+ },
103
+ "lastUpdated": "2026-01-05T17:52:52.971Z"
104
+ },
105
+ {
106
+ "hash": "01d04f7c17b4a541ead9d759d877b30b403e15b849182a49eb1f62bd29ecd18c",
107
+ "path": "docs/deployment/github-pages.md",
108
+ "metadata": {
109
+ "title": "GitHub Pages 部署配置",
110
+ "summary": "本文档介绍了 ZEN 项目文档站点的 GitHub Pages 部署配置,包括工作流程、触发条件、构建步骤、自定义配置、故障排除和手动触发方法。",
111
+ "tags": ["GitHub Pages", "部署配置", "工作流程", "文档构建", "故障排除", "ZEN 项目"],
112
+ "inferred_lang": "zh-Hans",
113
+ "tokens_used": {
114
+ "prompt": 1091,
115
+ "completion": 106,
116
+ "total": 1197
117
+ }
118
+ },
119
+ "lastUpdated": "2026-01-06T01:26:53.682Z"
120
+ },
121
+ {
122
+ "hash": "1e96be58d76c60056b708eb5bd8b8b81d7b5845d9cfe0b879d85068a5f11df3a",
123
+ "path": "docs/guides/best-practices.md",
124
+ "metadata": {
125
+ "title": "ZEN 文档站点最佳实践",
126
+ "summary": "本文档介绍了使用 ZEN 构建文档站点的最佳实践,涵盖多语言管理、性能优化、部署策略、维护建议、常见问题解决方案和高级技巧,旨在帮助用户高效开发和维护文档。",
127
+ "tags": ["ZEN", "文档站点", "最佳实践", "性能优化", "部署策略", "多语言管理", "维护建议"],
128
+ "inferred_lang": "zh-Hans",
129
+ "tokens_used": {
130
+ "prompt": 1282,
131
+ "completion": 116,
132
+ "total": 1398
133
+ }
134
+ },
135
+ "lastUpdated": "2026-01-06T01:26:58.919Z"
136
+ },
137
+ {
138
+ "hash": "80ae9bed74fc6348a7c1fe9f33e86b65f5d919169721f77bcf0e1bc29fbdb4f9",
139
+ "path": "docs/guides/config.md",
140
+ "metadata": {
141
+ "title": "ZEN 配置指南",
142
+ "summary": "本文档介绍了 ZEN 工具的配置和使用方法,包括基本命令如构建文档、实时预览和启动开发服务器,以及命令行选项如 --watch、--serve 和 --port 的详细说明。",
143
+ "tags": ["ZEN", "配置指南", "命令行", "文档构建", "开发服务器", "极简主义"],
144
+ "inferred_lang": "zh-Hans",
145
+ "tokens_used": {
146
+ "prompt": 669,
147
+ "completion": 109,
148
+ "total": 778
149
+ }
150
+ },
151
+ "lastUpdated": "2026-01-06T01:27:03.804Z"
152
+ }
153
+ ],
154
+ "timestamp": "2026-01-07T09:59:57.948Z"
155
+ }
@@ -0,0 +1,120 @@
1
+ ---
2
+ title: GitHub Pages Deployment Configuration
3
+ summary: This document describes the GitHub Pages deployment configuration for the ZEN project documentation site, including workflow, triggers, build steps, custom configurations, troubleshooting, and manual triggering methods.
4
+ tags:
5
+ - GitHub Pages
6
+ - Deployment Configuration
7
+ - Workflow
8
+ - Documentation Build
9
+ - Troubleshooting
10
+ - ZEN Project
11
+ inferred_lang: en-US
12
+ ---
13
+
14
+ # GitHub Pages Deployment Configuration
15
+
16
+ This directory contains the GitHub Pages deployment configuration for the ZEN project documentation site.
17
+
18
+ ## Workflow
19
+
20
+ ### `pages.yml`
21
+
22
+ This workflow automatically builds the ZEN project documentation site and deploys it to GitHub Pages.
23
+
24
+ **Triggers:**
25
+
26
+ - Push to the `main` branch (when changes occur in `demo/src/`, `package.json`, or workflow files)
27
+ - Pull Request targeting the `main` branch
28
+ - Manual trigger
29
+
30
+ **Workflow Steps:**
31
+
32
+ 1. **Checkout code**: Checks out code from the remote branch to ensure code synchronization.
33
+ 2. **Setup Node.js**: Configures the Node.js 20.x environment.
34
+ 3. **Install dependencies**: Installs project dependencies using `npm ci`.
35
+ 4. **Build zengen**: Builds the local zengen package.
36
+ 5. **Install zengen**: Installs the locally built zengen as a global tool.
37
+ 6. **Test zengen CLI**: Verifies the CLI tool works correctly.
38
+ 7. **Build documentation site**: Builds the documentation using `cd demo/src && zengen build`, outputting to the `.zen/dist` directory.
39
+ 8. **Configure Pages**: Sets up GitHub Pages.
40
+ 9. **Upload artifact**: Uploads the built documentation site as a Pages artifact.
41
+ 10. **Deploy to GitHub Pages**: Automatically deploys to GitHub Pages.
42
+
43
+ ## Accessing the Documentation Site
44
+
45
+ After successful deployment, the documentation site will be accessible at:
46
+
47
+ ```
48
+ https://[username].github.io/[repository-name]/
49
+ ```
50
+
51
+ ## Custom Configuration
52
+
53
+ ### Custom Domain
54
+
55
+ If a custom domain is needed, you can add a CNAME file after the build step:
56
+
57
+ ```yaml
58
+ # Create CNAME file (if custom domain is needed)
59
+ echo "docs.example.com" > docs-dist/CNAME
60
+ ```
61
+
62
+ ### Build Options
63
+
64
+ Currently used build command:
65
+
66
+ ```bash
67
+ cd demo/src
68
+ zengen build --verbose
69
+ ```
70
+
71
+ Available options:
72
+
73
+ - `--verbose`: Shows verbose output.
74
+ - `--watch`: Watch mode (not suitable for CI/CD).
75
+ - `--template`: Specifies a custom template file.
76
+ - `--config`: Specifies a configuration file.
77
+
78
+ ### Environment Variables
79
+
80
+ The workflow uses the following environment variables:
81
+
82
+ - `GITHUB_TOKEN`: Automatically provided GitHub token.
83
+ - `NODE_VERSION`: Node.js version (defaults to 20.x).
84
+
85
+ ## Troubleshooting
86
+
87
+ ### Build Failures
88
+
89
+ 1. **Check Node.js version**: Ensure a supported Node.js version is used.
90
+ 2. **Verify dependency installation**: Ensure `npm ci` executes successfully.
91
+ 3. **Check build output**: Review the verbose output of `zengen build`.
92
+ 4. **CLI output directory issue**: ZEN now forces output to the `.zen/dist` directory and no longer supports the `--out` parameter.
93
+
94
+ ### Deployment Failures
95
+
96
+ 1. **Check permissions**: Ensure the workflow has correct write permissions for Pages.
97
+ 2. **Verify artifact**: Ensure the `.zen/dist` directory contains valid HTML files.
98
+ 3. **Review logs**: Check GitHub Actions logs for detailed error messages.
99
+
100
+ ### Documentation Not Updating
101
+
102
+ 1. **Check triggers**: Ensure files in the `demo/src/` directory were modified.
103
+ 2. **Wait for deployment**: GitHub Pages deployment may take a few minutes.
104
+ 3. **Clear browser cache**: The browser might be caching an old version.
105
+
106
+ ## Manual Trigger
107
+
108
+ Deployment can be manually triggered via the GitHub Actions interface:
109
+
110
+ 1. Go to the repository's "Actions" tab.
111
+ 2. Select the "Deploy to GitHub Pages" workflow.
112
+ 3. Click the "Run workflow" button.
113
+ 4. Select the branch and run.
114
+
115
+ ## Related Files
116
+
117
+ - `demo/src/`: Documentation source files (Markdown format).
118
+ - `package.json`: Project configuration and dependencies.
119
+ - `src/cli.ts`: zengen CLI tool implementation.
120
+ - `src/builder.ts`: Documentation builder implementation.
@@ -0,0 +1,75 @@
1
+ ---
2
+ title: ZEN - Markdown Documentation Site Builder
3
+ summary: ZEN is a minimalist static site generator focused on building HTML sites from Markdown folders. It supports intelligent navigation and AI-powered incremental translation, emphasizing content-first and cross-language support without complex configuration.
4
+ tags:
5
+ - Markdown
6
+ - Static Site Generation
7
+ - AI Translation
8
+ - Minimalism
9
+ - Multilingual
10
+ - Documentation Tool
11
+ - ZEN
12
+ inferred_lang: en-US
13
+ ---
14
+
15
+ # ZEN - A Concise Markdown Documentation Site Builder
16
+
17
+ > 📖 **Reading Note**: This README is the Chinese version. The English version will be automatically generated by AI translation.
18
+
19
+ ## Project Motivation
20
+
21
+ ### Return to Content
22
+
23
+ I enjoy contemplation but dislike complex build tools, fiddling with intricate documentation configurations, and complicated structures.
24
+
25
+ ### Return to Native Language
26
+
27
+ Life is short, I use AI translation. Stay connected with the world.
28
+
29
+ ## Core Features
30
+
31
+ 1. **Static Site Generation**
32
+ - Build any folder containing Markdown files into a static HTML site.
33
+
34
+ 2. **Intelligent Navigation**
35
+ - Generate site maps and navigation without needing to maintain the original directory structure of the Markdown source files.
36
+
37
+ 3. **Incremental i18n Translation**
38
+ - Use LLM for incremental i18n translation, allowing users to write Markdown in their native language while supporting multilingual audiences.
39
+
40
+ ## Design Philosophy
41
+
42
+ - **Minimalism**: Minimal configuration, maximum flexibility.
43
+ - **Content-First**: Focus on writing, not tool configuration.
44
+ - **AI-Powered**: Leverage AI for translation and content organization.
45
+ - **Cross-Language**: Support multilingual content creation and display.
46
+
47
+ ## Quick Start
48
+
49
+ ### Recommended Usage
50
+
51
+ **It is recommended that users switch to the directory containing Markdown files and directly use the following command to start building:**
52
+
53
+ ```bash
54
+ npx zengen build
55
+ ```
56
+
57
+ ### Other Usages
58
+
59
+ 1. **Live Preview (Watch for file changes)**:
60
+
61
+ ```bash
62
+ npx zengen build --watch
63
+ ```
64
+
65
+ 2. **View more parameters or help**:
66
+
67
+ ```bash
68
+ npx zengen
69
+ ```
70
+
71
+ **Note**: ZEN enforces using the current directory as the source directory and outputs to the `.zen/dist` directory. Specifying source and output directory parameters is no longer supported.
72
+
73
+ ---
74
+
75
+ **ZEN** - Let documentation return to its essence, let writing return to tranquility.
@@ -0,0 +1,189 @@
1
+ ---
2
+ title: ZEN Documentation Site Best Practices
3
+ summary: This document introduces best practices for building documentation sites using ZEN, covering multilingual management, performance optimization, deployment strategies, maintenance recommendations, common issue solutions, and advanced techniques, aiming to help users efficiently develop and maintain documentation.
4
+ tags:
5
+ - ZEN
6
+ - Documentation Site
7
+ - Best Practices
8
+ - Performance Optimization
9
+ - Deployment Strategy
10
+ - Multilingual Management
11
+ - Maintenance Recommendations
12
+ inferred_lang: en-US
13
+ ---
14
+
15
+ # Best Practices
16
+
17
+ This document introduces best practices for building documentation sites using ZEN.
18
+
19
+ ## Multilingual Management
20
+
21
+ ### Translation Strategy
22
+
23
+ 1. **Primary Language First**: Write the complete documentation in your native language first.
24
+ 2. **Incremental Translation**: Only translate modified parts after each update.
25
+ 3. **Terminology Consistency**: Create a glossary to maintain translation consistency.
26
+ 4. **Human Proofreading**: It is recommended to perform human proofreading after AI translation.
27
+
28
+ ## Performance Optimization
29
+
30
+ ### Build Optimization
31
+
32
+ 1. **Incremental Builds**: Use `--watch` mode for development.
33
+ 2. **Cache Utilization**: ZEN automatically caches processing results.
34
+ 3. **Parallel Processing**: Automatically processes files in parallel on multi-core CPUs.
35
+
36
+ ### Development Workflow
37
+
38
+ ```bash
39
+ # Watch for changes during development
40
+ cd docs
41
+ npx zengen build --watch
42
+
43
+ # Start development server
44
+ npx zengen build --watch --serve
45
+
46
+ # Production build
47
+ npx zengen build
48
+ ```
49
+
50
+ ## Deployment Strategy
51
+
52
+ ### CI/CD Integration
53
+
54
+ #### GitHub Actions Example
55
+
56
+ ```yaml
57
+ name: Build and Deploy Documentation
58
+ on:
59
+ push:
60
+ branches: [main]
61
+ paths:
62
+ - 'docs/**'
63
+ - '.github/workflows/docs.yml'
64
+
65
+ jobs:
66
+ build:
67
+ runs-on: ubuntu-latest
68
+ steps:
69
+ - name: Checkout repository
70
+ uses: actions/checkout@v4
71
+
72
+ - name: Setup Node.js
73
+ uses: actions/setup-node@v4
74
+ with:
75
+ node-version: '20.x'
76
+
77
+ - name: Build documentation
78
+ run: |
79
+ cd docs
80
+ npx zengen build --base-url /my-docs
81
+
82
+ - name: Deploy to GitHub Pages
83
+ uses: peaceiris/actions-gh-pages@v3
84
+ with:
85
+ github_token: ${{ secrets.GITHUB_TOKEN }}
86
+ publish_dir: docs/.zen/dist
87
+ ```
88
+
89
+ #### Custom Deployment Script
90
+
91
+ ```bash
92
+ #!/bin/bash
93
+ # deploy-docs.sh
94
+
95
+ # Switch to the documentation directory
96
+ cd docs
97
+
98
+ # Build documentation
99
+ npx zengen build
100
+
101
+ # Sync to server
102
+ rsync -avz .zen/dist/ user@server:/var/www/docs/
103
+
104
+ # Clean cache
105
+ rm -rf .zen/cache
106
+ ```
107
+
108
+ ### Cloud Deployment Options
109
+
110
+ - **GitHub Pages**: Free hosting for documentation.
111
+ - **Vercel**: Automatic deployment for static sites.
112
+ - **Netlify**: Supports form handling and redirects.
113
+ - **AWS S3 + CloudFront**: Enterprise-grade static hosting.
114
+
115
+ ## Maintenance Recommendations
116
+
117
+ ### Regular Updates
118
+
119
+ 1. **Content Review**: Check documentation accuracy monthly.
120
+ 2. **Link Checking**: Regularly check for broken links.
121
+ 3. **Performance Monitoring**: Monitor page load speed.
122
+ 4. **User Feedback**: Collect user feedback to improve documentation.
123
+
124
+ ### Version Control
125
+
126
+ 1. **Documentation Versioning**: Synchronize with software versions.
127
+ 2. **Changelog**: Record documentation update history.
128
+ 3. **Rollback Mechanism**: Support quick rollback to previous versions.
129
+
130
+ ## Common Issues
131
+
132
+ ### Slow Build Speed
133
+
134
+ **Solutions:**
135
+
136
+ - Reduce unnecessary images and resources.
137
+ - Use `--watch` mode for incremental development.
138
+ - Split large documents into multiple smaller files.
139
+ - Disable unnecessary processors.
140
+
141
+ ### Poor Translation Quality
142
+
143
+ **Solutions:**
144
+
145
+ - Provide context to the AI translator.
146
+ - Create a glossary to improve consistency.
147
+ - Perform human proofreading for critical content.
148
+ - Adjust translation prompts.
149
+
150
+ ### Complex Navigation Structure
151
+
152
+ **Solutions:**
153
+
154
+ - Maintain a flat directory structure.
155
+ - Use clear heading hierarchies.
156
+ - Provide search functionality.
157
+ - Use sidebar navigation appropriately.
158
+
159
+ ### High Memory Usage
160
+
161
+ **Solutions:**
162
+
163
+ - Reduce the number of files processed simultaneously.
164
+ - Disable caching (not recommended).
165
+ - Increase system memory.
166
+ - Process large documents in batches.
167
+
168
+ ## Advanced Techniques
169
+
170
+ ### Custom Template Techniques
171
+
172
+ 1. **Responsive Design**: Ensure the template displays correctly on mobile devices.
173
+ 2. **Theme Switching**: Implement dark/light themes.
174
+ 3. **Code Highlighting**: Integrate highlight.js or other highlighting libraries.
175
+ 4. **Search Functionality**: Add client-side search.
176
+
177
+ ### Integrating Other Tools
178
+
179
+ 1. **Image Optimization**: Use sharp or imagemin to optimize images.
180
+ 2. **SEO Optimization**: Add meta tags and structured data.
181
+ 3. **Analytics Integration**: Integrate Google Analytics or Plausible.
182
+ 4. **CDN Acceleration**: Use a CDN to accelerate static resources.
183
+
184
+ ### Monitoring and Logging
185
+
186
+ 1. **Build Logs**: Use `--verbose` to view detailed logs.
187
+ 2. **Error Monitoring**: Set up error monitoring and alerts.
188
+ 3. **Performance Monitoring**: Monitor build time and resource usage.
189
+ 4. **User Analytics**: Analyze documentation usage.