zengen 0.1.36 → 0.2.1

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 (150) hide show
  1. package/.github/workflows/pages.yml +1 -1
  2. package/.zen/meta.json +112 -32
  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 +40 -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 +11 -0
  16. package/.zen/src/zh-Hans/80ae9bed74fc6348a7c1fe9f33e86b65f5d919169721f77bcf0e1bc29fbdb4f9.md +63 -0
  17. package/.zen/src/zh-Hans/f0c2799126931ccd113a0c45b1e623870b0d4f4f400becf6dd877da8f1011517.md +40 -0
  18. package/.zen/src/zh-Hans/fdfca9b960d0eaa8b2b96fe988ead7481d2c0b16f66ebc94fb477139b4178cdc.md +65 -0
  19. package/assets/templates/default/layout.html +274 -0
  20. package/dist/ai/extractMetadataFromMarkdown.d.ts +8 -0
  21. package/dist/ai/extractMetadataFromMarkdown.d.ts.map +1 -0
  22. package/dist/ai/extractMetadataFromMarkdown.js +88 -0
  23. package/dist/ai/extractMetadataFromMarkdown.js.map +1 -0
  24. package/dist/ai/translateMarkdown.d.ts +8 -0
  25. package/dist/ai/translateMarkdown.d.ts.map +1 -0
  26. package/dist/ai/translateMarkdown.js +29 -0
  27. package/dist/ai/translateMarkdown.js.map +1 -0
  28. package/dist/build/pipeline.d.ts +6 -0
  29. package/dist/build/pipeline.d.ts.map +1 -0
  30. package/dist/build/pipeline.js +219 -0
  31. package/dist/build/pipeline.js.map +1 -0
  32. package/dist/cli.js +10 -118
  33. package/dist/cli.js.map +1 -1
  34. package/dist/findEntries.d.ts +10 -0
  35. package/dist/findEntries.d.ts.map +1 -0
  36. package/dist/findEntries.js +38 -0
  37. package/dist/findEntries.js.map +1 -0
  38. package/dist/index.d.ts +1 -32
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +1 -35
  41. package/dist/index.js.map +1 -1
  42. package/dist/metadata.d.ts +14 -0
  43. package/dist/metadata.d.ts.map +1 -0
  44. package/dist/metadata.js +78 -0
  45. package/dist/metadata.js.map +1 -0
  46. package/dist/paths.d.ts +6 -0
  47. package/dist/paths.d.ts.map +1 -0
  48. package/dist/paths.js +10 -0
  49. package/dist/paths.js.map +1 -0
  50. package/dist/process/extractMetadataByAI.d.ts +5 -0
  51. package/dist/process/extractMetadataByAI.d.ts.map +1 -0
  52. package/dist/process/extractMetadataByAI.js +31 -0
  53. package/dist/process/extractMetadataByAI.js.map +1 -0
  54. package/dist/process/template.d.ts +5 -0
  55. package/dist/process/template.d.ts.map +1 -0
  56. package/dist/process/template.js +188 -0
  57. package/dist/process/template.js.map +1 -0
  58. package/dist/scan/files.d.ts +7 -0
  59. package/dist/scan/files.d.ts.map +1 -0
  60. package/dist/scan/files.js +54 -0
  61. package/dist/scan/files.js.map +1 -0
  62. package/dist/services/openai.d.ts +41 -0
  63. package/dist/services/openai.d.ts.map +1 -0
  64. package/dist/services/openai.js +54 -0
  65. package/dist/services/openai.js.map +1 -0
  66. package/dist/types.d.ts +16 -67
  67. package/dist/types.d.ts.map +1 -1
  68. package/dist/utils/convertMarkdownToHtml.d.ts +7 -0
  69. package/dist/utils/convertMarkdownToHtml.d.ts.map +1 -0
  70. package/dist/utils/convertMarkdownToHtml.js +39 -0
  71. package/dist/utils/convertMarkdownToHtml.js.map +1 -0
  72. package/dist/utils/frontmatter.d.ts +6 -0
  73. package/dist/utils/frontmatter.d.ts.map +1 -0
  74. package/dist/utils/frontmatter.js +22 -0
  75. package/dist/utils/frontmatter.js.map +1 -0
  76. package/docs/deployment/github-pages.md +1 -2
  77. package/docs/guides/best-practices.md +4 -4
  78. package/docs/guides/config.md +0 -5
  79. package/package.json +4 -2
  80. package/src/ai/extractMetadataFromMarkdown.ts +95 -0
  81. package/src/ai/translateMarkdown.ts +29 -0
  82. package/src/build/pipeline.ts +217 -0
  83. package/src/cli.ts +10 -132
  84. package/src/findEntries.ts +37 -0
  85. package/src/index.ts +1 -40
  86. package/src/metadata.ts +44 -0
  87. package/src/paths.ts +7 -0
  88. package/src/process/extractMetadataByAI.ts +31 -0
  89. package/src/process/template.ts +201 -0
  90. package/src/scan/files.ts +17 -0
  91. package/src/services/openai.ts +92 -0
  92. package/src/types.ts +18 -72
  93. package/src/utils/convertMarkdownToHtml.ts +32 -0
  94. package/src/utils/frontmatter.ts +18 -0
  95. package/.zen/translations.json +0 -51
  96. package/dist/ai-client.d.ts +0 -34
  97. package/dist/ai-client.d.ts.map +0 -1
  98. package/dist/ai-client.js +0 -180
  99. package/dist/ai-client.js.map +0 -1
  100. package/dist/ai-processor.d.ts +0 -51
  101. package/dist/ai-processor.d.ts.map +0 -1
  102. package/dist/ai-processor.js +0 -215
  103. package/dist/ai-processor.js.map +0 -1
  104. package/dist/ai-service.d.ts +0 -79
  105. package/dist/ai-service.d.ts.map +0 -1
  106. package/dist/ai-service.js +0 -257
  107. package/dist/ai-service.js.map +0 -1
  108. package/dist/builder.d.ts +0 -70
  109. package/dist/builder.d.ts.map +0 -1
  110. package/dist/builder.js +0 -854
  111. package/dist/builder.js.map +0 -1
  112. package/dist/gitignore.d.ts +0 -41
  113. package/dist/gitignore.d.ts.map +0 -1
  114. package/dist/gitignore.js +0 -202
  115. package/dist/gitignore.js.map +0 -1
  116. package/dist/gitignore.test.d.ts +0 -2
  117. package/dist/gitignore.test.d.ts.map +0 -1
  118. package/dist/gitignore.test.js +0 -309
  119. package/dist/gitignore.test.js.map +0 -1
  120. package/dist/markdown.d.ts +0 -35
  121. package/dist/markdown.d.ts.map +0 -1
  122. package/dist/markdown.js +0 -221
  123. package/dist/markdown.js.map +0 -1
  124. package/dist/navigation.d.ts +0 -46
  125. package/dist/navigation.d.ts.map +0 -1
  126. package/dist/navigation.js +0 -196
  127. package/dist/navigation.js.map +0 -1
  128. package/dist/scanner.d.ts +0 -26
  129. package/dist/scanner.d.ts.map +0 -1
  130. package/dist/scanner.js +0 -190
  131. package/dist/scanner.js.map +0 -1
  132. package/dist/template.d.ts +0 -33
  133. package/dist/template.d.ts.map +0 -1
  134. package/dist/template.js +0 -434
  135. package/dist/template.js.map +0 -1
  136. package/dist/translation-service.d.ts +0 -72
  137. package/dist/translation-service.d.ts.map +0 -1
  138. package/dist/translation-service.js +0 -291
  139. package/dist/translation-service.js.map +0 -1
  140. package/src/ai-client.ts +0 -227
  141. package/src/ai-processor.ts +0 -243
  142. package/src/ai-service.ts +0 -281
  143. package/src/builder.ts +0 -991
  144. package/src/gitignore.test.ts +0 -318
  145. package/src/gitignore.ts +0 -193
  146. package/src/markdown.ts +0 -212
  147. package/src/navigation.ts +0 -237
  148. package/src/scanner.ts +0 -180
  149. package/src/template.ts +0 -425
  150. 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,137 @@
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
+ },
23
+ {
24
+ "hash": "5ec990146b35e00de2630559126ee07f7cdcddeb23b0e8cab3d85b4181353e26",
25
+ "path": "docs/advanced-usage.md",
26
+ "metadata": {
27
+ "title": "ZEN 高级用法指南",
28
+ "summary": "本文档介绍了 ZEN 的高级功能,包括自定义 HTML 模板、配置选项(如源目录、输出目录、模板、基础 URL 和多语言支持)以及插件系统,帮助用户扩展和定制 ZEN 工具。",
29
+ "tags": ["ZEN", "高级用法", "自定义模板", "配置选项", "插件系统", "文档生成", "多语言支持"],
30
+ "inferred_lang": "zh-Hans",
31
+ "tokens_used": {
32
+ "prompt": 464,
33
+ "completion": 120,
34
+ "total": 584
35
+ }
36
+ }
37
+ },
38
+ {
39
+ "hash": "01d04f7c17b4a541ead9d759d877b30b403e15b849182a49eb1f62bd29ecd18c",
40
+ "path": "docs/deployment/github-pages.md",
41
+ "metadata": {
42
+ "title": "GitHub Pages 部署配置",
43
+ "summary": "本文档介绍了 ZEN 项目文档站点的 GitHub Pages 部署配置,包括工作流程、触发条件、构建步骤、自定义配置、故障排除和手动触发方法。",
44
+ "tags": ["GitHub Pages", "部署配置", "工作流程", "文档构建", "故障排除", "ZEN 项目"],
45
+ "inferred_lang": "zh-Hans",
46
+ "tokens_used": {
47
+ "prompt": 1091,
48
+ "completion": 106,
49
+ "total": 1197
50
+ }
51
+ }
52
+ },
53
+ {
54
+ "hash": "f0c2799126931ccd113a0c45b1e623870b0d4f4f400becf6dd877da8f1011517",
7
55
  "path": "docs/getting-started.md",
8
56
  "metadata": {
9
57
  "title": "快速开始指南",
10
- "summary": "本文档介绍如何快速开始使用 ZEN 文档生成器",
11
- "tags": ["getting-started", "tutorial", "documentation"],
12
- "inferred_date": "2025-12-01",
58
+ "summary": "本文档介绍如何快速开始使用 ZEN 文档生成器,包括安装步骤、基本用法和主要特性。",
59
+ "tags": ["ZEN 文档生成器", "快速开始", "安装", "基本用法", "特性", "Markdown", "构建命令"],
13
60
  "inferred_lang": "zh-Hans",
14
61
  "tokens_used": {
15
- "prompt": 100,
16
- "completion": 50,
17
- "total": 150
62
+ "prompt": 373,
63
+ "completion": 94,
64
+ "total": 467
18
65
  }
19
- },
20
- "lastUpdated": "2026-01-05T00:00:00.000Z"
66
+ }
21
67
  },
22
68
  {
23
- "hash": "def456",
24
- "path": "docs/advanced-usage.md",
69
+ "hash": "1e96be58d76c60056b708eb5bd8b8b81d7b5845d9cfe0b879d85068a5f11df3a",
70
+ "path": "docs/guides/best-practices.md",
25
71
  "metadata": {
26
- "title": "高级用法",
27
- "summary": "深入介绍 ZEN 的高级功能和配置选项",
28
- "tags": ["advanced", "configuration", "customization"],
29
- "inferred_date": "2025-12-15",
72
+ "title": "ZEN 文档站点最佳实践",
73
+ "summary": "本文档介绍了使用 ZEN 构建文档站点的最佳实践,涵盖多语言管理、性能优化、部署策略、维护建议、常见问题解决方案和高级技巧,旨在帮助用户高效开发和维护文档。",
74
+ "tags": ["ZEN", "文档站点", "最佳实践", "性能优化", "部署策略", "多语言管理", "维护建议"],
30
75
  "inferred_lang": "zh-Hans",
31
76
  "tokens_used": {
32
- "prompt": 120,
33
- "completion": 60,
34
- "total": 180
77
+ "prompt": 1282,
78
+ "completion": 116,
79
+ "total": 1398
35
80
  }
36
- },
37
- "lastUpdated": "2026-01-05T00:00:00.000Z"
81
+ }
38
82
  },
39
83
  {
40
- "hash": "ghi789",
41
- "path": "docs/deployment.md",
84
+ "hash": "80ae9bed74fc6348a7c1fe9f33e86b65f5d919169721f77bcf0e1bc29fbdb4f9",
85
+ "path": "docs/guides/config.md",
42
86
  "metadata": {
43
- "title": "部署指南",
44
- "summary": "如何将 ZEN 生成的文档部署到生产环境",
45
- "tags": ["deployment", "production", "hosting"],
46
- "inferred_date": "2025-12-20",
87
+ "title": "ZEN 配置指南",
88
+ "summary": "本文档介绍了 ZEN 工具的配置和使用方法,包括基本命令如构建文档、实时预览和启动开发服务器,以及命令行选项如 --watch、--serve 和 --port 的详细说明。",
89
+ "tags": ["ZEN", "配置指南", "命令行", "文档构建", "开发服务器", "极简主义"],
47
90
  "inferred_lang": "zh-Hans",
48
91
  "tokens_used": {
49
- "prompt": 80,
50
- "completion": 40,
51
- "total": 120
92
+ "prompt": 669,
93
+ "completion": 109,
94
+ "total": 778
95
+ }
96
+ }
97
+ },
98
+ {
99
+ "hash": "fdfca9b960d0eaa8b2b96fe988ead7481d2c0b16f66ebc94fb477139b4178cdc",
100
+ "path": "docs/guides/index.md",
101
+ "metadata": {
102
+ "title": "ZEN 文档站点示例",
103
+ "summary": "介绍 ZEN 文档构建工具,一个极简主义的 Markdown 文档站点生成器,包括特性、快速开始指南、代码示例和下一步学习资源。",
104
+ "tags": [
105
+ "ZEN",
106
+ "文档构建工具",
107
+ "Markdown",
108
+ "站点生成器",
109
+ "快速开始",
110
+ "代码示例",
111
+ "多语言支持"
112
+ ],
113
+ "inferred_lang": "zh-Hans",
114
+ "tokens_used": {
115
+ "prompt": 567,
116
+ "completion": 108,
117
+ "total": 675
118
+ }
119
+ }
120
+ },
121
+ {
122
+ "hash": "6124ea88edec5bde737b26b21f71ecfeffe4e73151784856edf813ee231a4baa",
123
+ "path": "docs/testing/test-document.md",
124
+ "metadata": {
125
+ "title": "Test Document",
126
+ "summary": "这是一个测试文档,内容为空,仅包含标题。",
127
+ "tags": ["测试", "文档", "示例"],
128
+ "inferred_lang": "en-US",
129
+ "tokens_used": {
130
+ "prompt": 265,
131
+ "completion": 58,
132
+ "total": 323
52
133
  }
53
- },
54
- "lastUpdated": "2026-01-05T00:00:00.000Z"
134
+ }
55
135
  }
56
136
  ]
57
137
  }
@@ -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, trigger conditions, build steps, custom configuration, troubleshooting, and manual trigger 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
+ **Trigger Conditions:**
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**: Check out code from the remote branch to ensure code synchronization.
33
+ 2. **Set up Node.js**: Configure the Node.js 20.x environment.
34
+ 3. **Install dependencies**: Install project dependencies using `npm ci`.
35
+ 4. **Build zengen**: Build the local zengen package.
36
+ 5. **Install zengen**: Install the locally built zengen as a global tool.
37
+ 6. **Test zengen CLI**: Verify the CLI tool functions correctly.
38
+ 7. **Build documentation site**: Build the documentation using `cd demo/src && zengen build`, outputting to the `.zen/dist` directory.
39
+ 8. **Configure Pages**: Set up GitHub Pages.
40
+ 9. **Upload artifact**: Upload the built documentation site as a Pages artifact.
41
+ 10. **Deploy to GitHub Pages**: Automatically deploy to GitHub Pages.
42
+
43
+ ## Accessing the Documentation Site
44
+
45
+ After successful deployment, the documentation site will be accessible at the following URL:
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 a 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`: Show verbose output.
74
+ - `--watch`: Watch mode (not suitable for CI/CD).
75
+ - `--template`: Specify a custom template file.
76
+ - `--config`: Specify 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 Failure
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 Failure
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 Updated
101
+
102
+ 1. **Check trigger conditions**: Ensure files in the `demo/src/` directory were modified.
103
+ 2. **Wait for deployment completion**: GitHub Pages deployment may take a few minutes.
104
+ 3. **Clear browser cache**: The browser may 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 a static HTML site from any folder containing Markdown files.
33
+
34
+ 2. **Intelligent Navigation**
35
+ - Generate site maps and navigation without needing to preserve 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 Review**: It is recommended to perform human review 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**: Files are automatically processed 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 review 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
@@ -0,0 +1,61 @@
1
+ ---
2
+ title: ZEN Configuration Guide
3
+ summary: This document introduces the configuration and usage of the ZEN tool, including basic commands such as building documentation, live preview, and starting a development server, as well as detailed explanations of command-line options like --watch, --serve, and --port.
4
+ tags:
5
+ - ZEN
6
+ - Configuration Guide
7
+ - Command Line
8
+ - Documentation Build
9
+ - Development Server
10
+ - Minimalism
11
+ inferred_lang: en-US
12
+ ---
13
+
14
+ # Configuration Guide
15
+
16
+ ZEN is designed with a minimalist philosophy, making its configuration very simple.
17
+
18
+ ## Command Line Usage
19
+
20
+ ### Basic Commands
21
+
22
+ ```bash
23
+ # Build documentation (recommended usage)
24
+ npx zengen build
25
+
26
+ # Live preview (watch for file changes)
27
+ npx zengen build --watch
28
+
29
+ # Start development server (requires --watch)
30
+ npx zengen build --watch --serve
31
+
32
+ # Custom port
33
+ npx zengen build --watch --serve --port 8080
34
+
35
+ # Show verbose logs
36
+ npx zengen build --verbose
37
+
38
+ # Set base URL
39
+ npx zengen build --base-url /my-docs
40
+
41
+ # View help
42
+ npx zengen
43
+ ```
44
+
45
+ **Important Notes:**
46
+
47
+ - ZEN enforces the use of the current directory as the source directory, outputting to the `.zen/dist` directory.
48
+ - Specifying source and output directories via command-line arguments is no longer supported.
49
+ - When using `--watch` mode, modifying files triggers automatic rebuilds.
50
+
51
+ ### Command Line Options
52
+
53
+ | Option | Short | Description | Default |
54
+ | ------------ | ----- | ------------------------------------------------ | ----------- |
55
+ | `--watch` | `-w` | Watch for file changes and rebuild automatically | `false` |
56
+ | `--serve` | `-s` | Start development server (requires `--watch`) | `false` |
57
+ | `--port` | `-p` | Development server port | `3000` |
58
+ | `--host` | | Development server host | `localhost` |
59
+ | `--verbose` | `-v` | Show verbose logs | `false` |
60
+ | `--base-url` | | Site base URL | None |
61
+ | `--help` | `-h` | Show help information | None |