zengen 0.1.36 → 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 (153) hide show
  1. package/.github/workflows/pages.yml +1 -1
  2. package/.zen/meta.json +128 -30
  3. package/.zen/src/en-US/01d04f7c17b4a541ead9d759d877b30b403e15b849182a49eb1f62bd29ecd18c.md +120 -0
  4. package/.zen/src/en-US/1b798c44a4f353e47296ca83d5905e37e6aba3e90bbd9bc3b3d34fc12059a2ca.md +75 -0
  5. package/.zen/src/en-US/1e96be58d76c60056b708eb5bd8b8b81d7b5845d9cfe0b879d85068a5f11df3a.md +189 -0
  6. package/.zen/src/en-US/5ec990146b35e00de2630559126ee07f7cdcddeb23b0e8cab3d85b4181353e26.md +53 -0
  7. package/.zen/src/en-US/6124ea88edec5bde737b26b21f71ecfeffe4e73151784856edf813ee231a4baa.md +11 -0
  8. package/.zen/src/en-US/80ae9bed74fc6348a7c1fe9f33e86b65f5d919169721f77bcf0e1bc29fbdb4f9.md +61 -0
  9. package/.zen/src/en-US/f0c2799126931ccd113a0c45b1e623870b0d4f4f400becf6dd877da8f1011517.md +41 -0
  10. package/.zen/src/en-US/fdfca9b960d0eaa8b2b96fe988ead7481d2c0b16f66ebc94fb477139b4178cdc.md +65 -0
  11. package/.zen/src/zh-Hans/01d04f7c17b4a541ead9d759d877b30b403e15b849182a49eb1f62bd29ecd18c.md +120 -0
  12. package/.zen/src/zh-Hans/1b798c44a4f353e47296ca83d5905e37e6aba3e90bbd9bc3b3d34fc12059a2ca.md +77 -0
  13. package/.zen/src/zh-Hans/1e96be58d76c60056b708eb5bd8b8b81d7b5845d9cfe0b879d85068a5f11df3a.md +189 -0
  14. package/.zen/src/zh-Hans/5ec990146b35e00de2630559126ee07f7cdcddeb23b0e8cab3d85b4181353e26.md +55 -0
  15. package/.zen/src/zh-Hans/6124ea88edec5bde737b26b21f71ecfeffe4e73151784856edf813ee231a4baa.md +1 -0
  16. package/.zen/src/zh-Hans/6ad8db715a1b60613fe934fefb29fa981ecad9b63145593accff144d73b44bde.md +175 -0
  17. package/.zen/src/zh-Hans/80ae9bed74fc6348a7c1fe9f33e86b65f5d919169721f77bcf0e1bc29fbdb4f9.md +63 -0
  18. package/.zen/src/zh-Hans/a1580f71c6c6c1ff4a314be72d410a8507af2f087d56360c7f5048d349c21953.md +48 -0
  19. package/.zen/src/zh-Hans/d49012f98c4367b34034063400e2f7826bf0615952210c82396920172d468e2c.md +107 -0
  20. package/.zen/src/zh-Hans/f0c2799126931ccd113a0c45b1e623870b0d4f4f400becf6dd877da8f1011517.md +41 -0
  21. package/.zen/src/zh-Hans/fdfca9b960d0eaa8b2b96fe988ead7481d2c0b16f66ebc94fb477139b4178cdc.md +65 -0
  22. package/assets/templates/default/layout.html +274 -0
  23. package/dist/ai/extractMetadataFromMarkdown.d.ts +8 -0
  24. package/dist/ai/extractMetadataFromMarkdown.d.ts.map +1 -0
  25. package/dist/ai/extractMetadataFromMarkdown.js +88 -0
  26. package/dist/ai/extractMetadataFromMarkdown.js.map +1 -0
  27. package/dist/ai/translateMarkdown.d.ts +8 -0
  28. package/dist/ai/translateMarkdown.d.ts.map +1 -0
  29. package/dist/ai/translateMarkdown.js +29 -0
  30. package/dist/ai/translateMarkdown.js.map +1 -0
  31. package/dist/build/pipeline.d.ts +6 -0
  32. package/dist/build/pipeline.d.ts.map +1 -0
  33. package/dist/build/pipeline.js +218 -0
  34. package/dist/build/pipeline.js.map +1 -0
  35. package/dist/cli.js +10 -118
  36. package/dist/cli.js.map +1 -1
  37. package/dist/findEntries.d.ts +10 -0
  38. package/dist/findEntries.d.ts.map +1 -0
  39. package/dist/findEntries.js +38 -0
  40. package/dist/findEntries.js.map +1 -0
  41. package/dist/index.d.ts +1 -32
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +1 -35
  44. package/dist/index.js.map +1 -1
  45. package/dist/metadata.d.ts +14 -0
  46. package/dist/metadata.d.ts.map +1 -0
  47. package/dist/metadata.js +78 -0
  48. package/dist/metadata.js.map +1 -0
  49. package/dist/paths.d.ts +6 -0
  50. package/dist/paths.d.ts.map +1 -0
  51. package/dist/paths.js +10 -0
  52. package/dist/paths.js.map +1 -0
  53. package/dist/process/extractMetadataByAI.d.ts +5 -0
  54. package/dist/process/extractMetadataByAI.d.ts.map +1 -0
  55. package/dist/process/extractMetadataByAI.js +31 -0
  56. package/dist/process/extractMetadataByAI.js.map +1 -0
  57. package/dist/process/template.d.ts +5 -0
  58. package/dist/process/template.d.ts.map +1 -0
  59. package/dist/process/template.js +188 -0
  60. package/dist/process/template.js.map +1 -0
  61. package/dist/scan/files.d.ts +7 -0
  62. package/dist/scan/files.d.ts.map +1 -0
  63. package/dist/scan/files.js +54 -0
  64. package/dist/scan/files.js.map +1 -0
  65. package/dist/services/openai.d.ts +41 -0
  66. package/dist/services/openai.d.ts.map +1 -0
  67. package/dist/services/openai.js +54 -0
  68. package/dist/services/openai.js.map +1 -0
  69. package/dist/types.d.ts +16 -67
  70. package/dist/types.d.ts.map +1 -1
  71. package/dist/utils/convertMarkdownToHtml.d.ts +7 -0
  72. package/dist/utils/convertMarkdownToHtml.d.ts.map +1 -0
  73. package/dist/utils/convertMarkdownToHtml.js +39 -0
  74. package/dist/utils/convertMarkdownToHtml.js.map +1 -0
  75. package/dist/utils/frontmatter.d.ts +6 -0
  76. package/dist/utils/frontmatter.d.ts.map +1 -0
  77. package/dist/utils/frontmatter.js +22 -0
  78. package/dist/utils/frontmatter.js.map +1 -0
  79. package/docs/deployment/github-pages.md +1 -2
  80. package/docs/guides/best-practices.md +4 -4
  81. package/docs/guides/config.md +0 -5
  82. package/package.json +4 -2
  83. package/src/ai/extractMetadataFromMarkdown.ts +95 -0
  84. package/src/ai/translateMarkdown.ts +29 -0
  85. package/src/build/pipeline.ts +211 -0
  86. package/src/cli.ts +10 -132
  87. package/src/findEntries.ts +37 -0
  88. package/src/index.ts +1 -40
  89. package/src/metadata.ts +44 -0
  90. package/src/paths.ts +7 -0
  91. package/src/process/extractMetadataByAI.ts +29 -0
  92. package/src/process/template.ts +201 -0
  93. package/src/scan/files.ts +17 -0
  94. package/src/services/openai.ts +92 -0
  95. package/src/types.ts +18 -72
  96. package/src/utils/convertMarkdownToHtml.ts +32 -0
  97. package/src/utils/frontmatter.ts +18 -0
  98. package/.zen/translations.json +0 -51
  99. package/dist/ai-client.d.ts +0 -34
  100. package/dist/ai-client.d.ts.map +0 -1
  101. package/dist/ai-client.js +0 -180
  102. package/dist/ai-client.js.map +0 -1
  103. package/dist/ai-processor.d.ts +0 -51
  104. package/dist/ai-processor.d.ts.map +0 -1
  105. package/dist/ai-processor.js +0 -215
  106. package/dist/ai-processor.js.map +0 -1
  107. package/dist/ai-service.d.ts +0 -79
  108. package/dist/ai-service.d.ts.map +0 -1
  109. package/dist/ai-service.js +0 -257
  110. package/dist/ai-service.js.map +0 -1
  111. package/dist/builder.d.ts +0 -70
  112. package/dist/builder.d.ts.map +0 -1
  113. package/dist/builder.js +0 -854
  114. package/dist/builder.js.map +0 -1
  115. package/dist/gitignore.d.ts +0 -41
  116. package/dist/gitignore.d.ts.map +0 -1
  117. package/dist/gitignore.js +0 -202
  118. package/dist/gitignore.js.map +0 -1
  119. package/dist/gitignore.test.d.ts +0 -2
  120. package/dist/gitignore.test.d.ts.map +0 -1
  121. package/dist/gitignore.test.js +0 -309
  122. package/dist/gitignore.test.js.map +0 -1
  123. package/dist/markdown.d.ts +0 -35
  124. package/dist/markdown.d.ts.map +0 -1
  125. package/dist/markdown.js +0 -221
  126. package/dist/markdown.js.map +0 -1
  127. package/dist/navigation.d.ts +0 -46
  128. package/dist/navigation.d.ts.map +0 -1
  129. package/dist/navigation.js +0 -196
  130. package/dist/navigation.js.map +0 -1
  131. package/dist/scanner.d.ts +0 -26
  132. package/dist/scanner.d.ts.map +0 -1
  133. package/dist/scanner.js +0 -190
  134. package/dist/scanner.js.map +0 -1
  135. package/dist/template.d.ts +0 -33
  136. package/dist/template.d.ts.map +0 -1
  137. package/dist/template.js +0 -434
  138. package/dist/template.js.map +0 -1
  139. package/dist/translation-service.d.ts +0 -72
  140. package/dist/translation-service.d.ts.map +0 -1
  141. package/dist/translation-service.js +0 -291
  142. package/dist/translation-service.js.map +0 -1
  143. package/src/ai-client.ts +0 -227
  144. package/src/ai-processor.ts +0 -243
  145. package/src/ai-service.ts +0 -281
  146. package/src/builder.ts +0 -991
  147. package/src/gitignore.test.ts +0 -318
  148. package/src/gitignore.ts +0 -193
  149. package/src/markdown.ts +0 -212
  150. package/src/navigation.ts +0 -237
  151. package/src/scanner.ts +0 -180
  152. package/src/template.ts +0 -425
  153. package/src/translation-service.ts +0 -350
@@ -35,7 +35,7 @@ jobs:
35
35
 
36
36
  - name: Create documentation site
37
37
  run: |
38
- npx zengen@latest build --base-url /ZEN
38
+ npx zengen@latest build --base-url /ZEN --lang zh-Hans --lang en-US
39
39
 
40
40
  - name: Setup Pages
41
41
  uses: actions/configure-pages@v4
package/.zen/meta.json CHANGED
@@ -1,57 +1,155 @@
1
1
  {
2
2
  "version": "1.0.0",
3
- "timestamp": "2026-01-05T00:00:00.000Z",
3
+ "options": {
4
+ "verbose": true,
5
+ "langs": ["zh-Hans", "en-US"]
6
+ },
4
7
  "files": [
5
8
  {
6
- "hash": "abc123",
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",
7
42
  "path": "docs/getting-started.md",
8
43
  "metadata": {
9
44
  "title": "快速开始指南",
10
- "summary": "本文档介绍如何快速开始使用 ZEN 文档生成器",
11
- "tags": ["getting-started", "tutorial", "documentation"],
12
- "inferred_date": "2025-12-01",
45
+ "summary": "本文档介绍了ZEN文档生成器的快速入门方法,包括安装步骤、基本使用流程和主要特性,帮助用户快速上手。",
46
+ "tags": [
47
+ "ZEN文档生成器",
48
+ "快速开始",
49
+ "安装",
50
+ "基本用法",
51
+ "特性",
52
+ "Markdown",
53
+ "AI辅助",
54
+ "多语言支持"
55
+ ],
13
56
  "inferred_lang": "zh-Hans",
14
57
  "tokens_used": {
15
- "prompt": 100,
16
- "completion": 50,
17
- "total": 150
58
+ "prompt": 373,
59
+ "completion": 102,
60
+ "total": 475
18
61
  }
19
62
  },
20
- "lastUpdated": "2026-01-05T00:00:00.000Z"
63
+ "lastUpdated": "2026-01-05T17:52:38.265Z"
21
64
  },
22
65
  {
23
- "hash": "def456",
24
- "path": "docs/advanced-usage.md",
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",
25
124
  "metadata": {
26
- "title": "高级用法",
27
- "summary": "深入介绍 ZEN 的高级功能和配置选项",
28
- "tags": ["advanced", "configuration", "customization"],
29
- "inferred_date": "2025-12-15",
125
+ "title": "ZEN 文档站点最佳实践",
126
+ "summary": "本文档介绍了使用 ZEN 构建文档站点的最佳实践,涵盖多语言管理、性能优化、部署策略、维护建议、常见问题解决方案和高级技巧,旨在帮助用户高效开发和维护文档。",
127
+ "tags": ["ZEN", "文档站点", "最佳实践", "性能优化", "部署策略", "多语言管理", "维护建议"],
30
128
  "inferred_lang": "zh-Hans",
31
129
  "tokens_used": {
32
- "prompt": 120,
33
- "completion": 60,
34
- "total": 180
130
+ "prompt": 1282,
131
+ "completion": 116,
132
+ "total": 1398
35
133
  }
36
134
  },
37
- "lastUpdated": "2026-01-05T00:00:00.000Z"
135
+ "lastUpdated": "2026-01-06T01:26:58.919Z"
38
136
  },
39
137
  {
40
- "hash": "ghi789",
41
- "path": "docs/deployment.md",
138
+ "hash": "80ae9bed74fc6348a7c1fe9f33e86b65f5d919169721f77bcf0e1bc29fbdb4f9",
139
+ "path": "docs/guides/config.md",
42
140
  "metadata": {
43
- "title": "部署指南",
44
- "summary": "如何将 ZEN 生成的文档部署到生产环境",
45
- "tags": ["deployment", "production", "hosting"],
46
- "inferred_date": "2025-12-20",
141
+ "title": "ZEN 配置指南",
142
+ "summary": "本文档介绍了 ZEN 工具的配置和使用方法,包括基本命令如构建文档、实时预览和启动开发服务器,以及命令行选项如 --watch、--serve 和 --port 的详细说明。",
143
+ "tags": ["ZEN", "配置指南", "命令行", "文档构建", "开发服务器", "极简主义"],
47
144
  "inferred_lang": "zh-Hans",
48
145
  "tokens_used": {
49
- "prompt": 80,
50
- "completion": 40,
51
- "total": 120
146
+ "prompt": 669,
147
+ "completion": 109,
148
+ "total": 778
52
149
  }
53
150
  },
54
- "lastUpdated": "2026-01-05T00:00:00.000Z"
151
+ "lastUpdated": "2026-01-06T01:27:03.804Z"
55
152
  }
56
- ]
153
+ ],
154
+ "timestamp": "2026-01-07T09:59:57.948Z"
57
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.
@@ -0,0 +1,53 @@
1
+ ---
2
+ title: ZEN Advanced Usage Guide
3
+ summary: This document introduces the advanced features of ZEN, including custom HTML templates, configuration options (such as source directory, output directory, template, base URL, and multilingual support), and the plugin system, helping users extend and customize the ZEN tool.
4
+ tags:
5
+ - ZEN
6
+ - Advanced Usage
7
+ - Custom Templates
8
+ - Configuration Options
9
+ - Plugin System
10
+ - Documentation Generation
11
+ - Multilingual Support
12
+ inferred_lang: en-US
13
+ ---
14
+
15
+ # Advanced Usage
16
+
17
+ An in-depth introduction to the advanced features and configuration options of ZEN.
18
+
19
+ ## Custom Templates
20
+
21
+ ZEN supports custom HTML templates:
22
+
23
+ ```bash
24
+ zengen build --src ./docs --out ./dist --template ./custom-template.html
25
+ ```
26
+
27
+ ## Configuration Options
28
+
29
+ Can be configured in the `.zenrc` file:
30
+
31
+ ```json
32
+ {
33
+ "srcDir": "./docs",
34
+ "outDir": "./dist",
35
+ "template": "./template.html",
36
+ "baseUrl": "https://example.com",
37
+ "i18n": {
38
+ "sourceLang": "zh-Hans",
39
+ "targetLangs": ["en-US", "ja-JP"]
40
+ }
41
+ }
42
+ ```
43
+
44
+ ## Plugin System
45
+
46
+ ZEN supports plugin extensions:
47
+
48
+ ```typescript
49
+ interface MarkdownProcessor {
50
+ beforeParse?(content: string, fileInfo: FileInfo): string | Promise<string>;
51
+ afterParse?(html: string, fileInfo: FileInfo): string | Promise<string>;
52
+ }
53
+ ```
@@ -0,0 +1,11 @@
1
+ ---
2
+ title: Test Document
3
+ summary: 这是一个测试文档,内容为空,仅包含标题。
4
+ tags:
5
+ - 测试
6
+ - 文档
7
+ - 示例
8
+ inferred_lang: en-US
9
+ ---
10
+
11
+ # Test Document