hd-garden 0.8.0 → 0.8.2

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 (187) hide show
  1. package/.agents/skills/garden-ui/SKILL.md +2 -2
  2. package/.env.en.example +67 -0
  3. package/README.en.md +2 -2
  4. package/README.md +2 -2
  5. package/app/a2/[slug]/page.tsx +4 -3
  6. package/app/a2/page.tsx +4 -3
  7. package/app/about/page.tsx +8 -9
  8. package/app/admin/page.tsx +7 -6
  9. package/app/admin/preview/[...path]/page.tsx +2 -1
  10. package/app/admin/ui/blocks/page.tsx +2 -1
  11. package/app/admin/ui/catalog/page.tsx +2 -1
  12. package/app/admin/ui/evals/page.tsx +2 -1
  13. package/app/admin/ui/page.tsx +2 -1
  14. package/app/blog/[...path]/page.tsx +7 -6
  15. package/app/blog/page.tsx +4 -2
  16. package/app/columns/[column]/[...path]/page.tsx +8 -7
  17. package/app/columns/page.tsx +12 -8
  18. package/app/components/AdminUiShell.tsx +4 -3
  19. package/app/components/ArticleMeasure.tsx +6 -3
  20. package/app/components/ArticleReferences.tsx +4 -1
  21. package/app/components/ArticleTags.tsx +3 -2
  22. package/app/components/BlogArchive.tsx +20 -16
  23. package/app/components/Comments.tsx +16 -10
  24. package/app/components/ContentEmptyState.tsx +29 -28
  25. package/app/components/ExternalEmbed.tsx +15 -14
  26. package/app/components/GardenContentGuide.tsx +10 -2
  27. package/app/components/GardenDocsNav.tsx +4 -2
  28. package/app/components/GiscusComments.tsx +2 -1
  29. package/app/components/GithubLiveOverview.tsx +10 -8
  30. package/app/components/GithubProfile.tsx +31 -21
  31. package/app/components/HandbookLangSwitch.tsx +8 -4
  32. package/app/components/HandbookView.tsx +92 -9
  33. package/app/components/MarkdownArticle.tsx +31 -7
  34. package/app/components/MermaidDiagram.tsx +4 -3
  35. package/app/components/SiteChrome.tsx +3 -3
  36. package/app/components/SiteFooter.tsx +1 -1
  37. package/app/components/SiteHeader.tsx +13 -4
  38. package/app/components/ThoughtCard.tsx +16 -14
  39. package/app/components/UiBlock.tsx +3 -2
  40. package/app/components/Webmentions.tsx +11 -11
  41. package/app/components/WidgetChart.tsx +8 -6
  42. package/app/components/garden/FilePreview.tsx +2 -2
  43. package/app/components/garden/GardenBlock.tsx +7 -0
  44. package/app/components/garden/GardenFile.tsx +2 -2
  45. package/app/components/garden/RefDemo.tsx +62 -0
  46. package/app/components/garden/blocks.tsx +56 -8
  47. package/app/components/garden/patterns.tsx +497 -0
  48. package/app/garden/[...slug]/page.tsx +3 -2
  49. package/app/garden/en/page.tsx +7 -7
  50. package/app/garden/page.tsx +3 -2
  51. package/app/globals.css +49 -1
  52. package/app/lib/a2-meta.ts +26 -3
  53. package/app/lib/content.ts +2 -2
  54. package/app/lib/garden-docs-meta.ts +24 -0
  55. package/app/lib/github-id.mjs +8 -0
  56. package/app/lib/handbook-switch.mjs +12 -0
  57. package/app/lib/i18n.ts +401 -2
  58. package/app/lib/rehype-field-tables.mjs +47 -0
  59. package/app/lib/remark-a2.mjs +18 -8
  60. package/app/lib/remark-link-card.mjs +22 -0
  61. package/app/lib/remark-ref-demos.mjs +42 -0
  62. package/app/lib/tag-filter.ts +9 -2
  63. package/app/not-found.tsx +32 -4
  64. package/app/page.tsx +17 -14
  65. package/app/rss.xml/route.ts +2 -1
  66. package/app/styles/a2.css +338 -0
  67. package/app/styles/shell.css +15 -2
  68. package/app/tags/page.tsx +7 -5
  69. package/app/thoughts/[slug]/page.tsx +2 -1
  70. package/app/thoughts/page/[n]/page.tsx +1 -1
  71. package/app/thoughts/page.tsx +2 -1
  72. package/app/ui-parity/page.tsx +38 -22
  73. package/bin/garden.mjs +129 -19
  74. package/docs/handbook/ai-writing.md +2 -2
  75. package/docs/handbook/assets/reading-layout-en.svg +26 -0
  76. package/docs/handbook/components/card.md +43 -22
  77. package/docs/handbook/components/chart.md +10 -26
  78. package/docs/handbook/components/choice.md +42 -0
  79. package/docs/handbook/components/compare.md +32 -17
  80. package/docs/handbook/components/figure.md +33 -46
  81. package/docs/handbook/components/file.md +10 -15
  82. package/docs/handbook/components/html.md +10 -30
  83. package/docs/handbook/components/interactive.md +9 -35
  84. package/docs/handbook/components/list.md +65 -0
  85. package/docs/handbook/components/relations.md +95 -0
  86. package/docs/handbook/components/stat.md +10 -28
  87. package/docs/handbook/components/timeline.md +13 -28
  88. package/docs/handbook/components.md +210 -19
  89. package/docs/handbook/config.md +5 -3
  90. package/docs/handbook/deploy.md +1 -1
  91. package/docs/handbook/design.md +20 -12
  92. package/docs/handbook/en/ai-writing.md +2 -2
  93. package/docs/handbook/en/components/card.md +42 -21
  94. package/docs/handbook/en/components/chart.md +10 -26
  95. package/docs/handbook/en/components/choice.md +42 -0
  96. package/docs/handbook/en/components/compare.md +30 -15
  97. package/docs/handbook/en/components/figure.md +29 -42
  98. package/docs/handbook/en/components/file.md +9 -14
  99. package/docs/handbook/en/components/html.md +9 -29
  100. package/docs/handbook/en/components/interactive.md +8 -34
  101. package/docs/handbook/en/components/list.md +65 -0
  102. package/docs/handbook/en/components/relations.md +95 -0
  103. package/docs/handbook/en/components/stat.md +9 -27
  104. package/docs/handbook/en/components/timeline.md +9 -24
  105. package/docs/handbook/en/components.md +211 -19
  106. package/docs/handbook/en/config.md +32 -30
  107. package/docs/handbook/en/deploy.md +12 -12
  108. package/docs/handbook/en/design.md +19 -12
  109. package/docs/handbook/en/index.md +2 -2
  110. package/docs/handbook/en/reference/card.md +85 -0
  111. package/docs/handbook/en/reference/chart.md +68 -0
  112. package/docs/handbook/en/reference/choice.md +69 -0
  113. package/docs/handbook/en/reference/compare.md +59 -0
  114. package/docs/handbook/en/reference/figure.md +84 -0
  115. package/docs/handbook/en/reference/file/checklist.md +17 -0
  116. package/docs/handbook/en/reference/file.md +50 -0
  117. package/docs/handbook/en/reference/html.md +62 -0
  118. package/docs/handbook/en/reference/interactive.md +71 -0
  119. package/docs/handbook/en/reference/list.md +72 -0
  120. package/docs/handbook/en/reference/relations.md +113 -0
  121. package/docs/handbook/en/reference/stat.md +60 -0
  122. package/docs/handbook/en/reference/timeline.md +56 -0
  123. package/docs/handbook/en/reference.md +26 -0
  124. package/docs/handbook/en/start.md +2 -2
  125. package/docs/handbook/en/workflow.md +6 -5
  126. package/docs/handbook/en/writing.md +3 -2
  127. package/docs/handbook/index.md +1 -1
  128. package/docs/handbook/reference/card.md +85 -0
  129. package/docs/handbook/reference/chart.md +68 -0
  130. package/docs/handbook/reference/choice.md +69 -0
  131. package/docs/handbook/reference/compare.md +59 -0
  132. package/docs/handbook/reference/figure.md +84 -0
  133. package/docs/handbook/reference/file/checklist.md +17 -0
  134. package/docs/handbook/reference/file.md +50 -0
  135. package/docs/handbook/reference/html.md +62 -0
  136. package/docs/handbook/reference/interactive.md +71 -0
  137. package/docs/handbook/reference/list.md +72 -0
  138. package/docs/handbook/reference/relations.md +113 -0
  139. package/docs/handbook/reference/stat.md +60 -0
  140. package/docs/handbook/reference/timeline.md +56 -0
  141. package/docs/handbook/reference.md +26 -0
  142. package/docs/handbook/start.md +1 -1
  143. package/docs/handbook/workflow.md +6 -5
  144. package/docs/handbook/writing.md +3 -2
  145. package/next.config.ts +6 -0
  146. package/package.json +2 -1
  147. package/public/images/garden/ref-card-book.svg +1 -0
  148. package/public/images/garden/ref-card-lamp.svg +1 -0
  149. package/scripts/build-content.mjs +37 -16
  150. package/scripts/favicon-ico.mjs +9 -6
  151. package/scripts/file-preview.mjs +10 -7
  152. package/scripts/handbook-allowlist.mjs +18 -0
  153. package/scripts/handbook-facts.mjs +305 -11
  154. package/scripts/link-assets.mjs +7 -0
  155. package/scripts/new-post.mjs +18 -9
  156. package/scripts/prepare-pages-output.mjs +30 -18
  157. package/scripts/redirects.mjs +17 -6
  158. package/templates/garden-blocks.md +67 -0
  159. package/templates/garden-snippets.plist +61 -0
  160. package/templates/site/Makefile.en +45 -0
  161. package/templates/site/README.en.md +15 -0
  162. package/templates/site/site.config.en.yaml +55 -0
  163. package/templates/skills-en/garden-interactive-chart/SKILL.md +84 -0
  164. package/templates/skills-en/garden-interactive-chart/references/shell.html +49 -0
  165. package/templates/skills-en/garden-interactive-chart/references/style.md +61 -0
  166. package/templates/skills-en/garden-post-review/SKILL.md +63 -0
  167. package/templates/skills-en/garden-ui/SKILL.md +118 -0
  168. package/templates/workflows/pages.en.yml +195 -0
  169. package/templates/workflows/pages.yml +195 -0
  170. package/ui/garden/catalog.mjs +205 -4
  171. package/ui/garden/check.mjs +6 -0
  172. package/ui/garden/file-block.mjs +8 -7
  173. package/ui/garden/html-lang.mjs +73 -1
  174. package/ui/garden/markdown-links.mjs +7 -4
  175. package/ui/garden/parse.mjs +45 -0
  176. package/ui/garden/relations.mjs +252 -0
  177. package/ui/garden/search-index.mjs +6 -4
  178. package/ui/garden/source-icon.mjs +54 -0
  179. package/ui/parity-fixtures.mjs +77 -0
  180. package/ui/preview/dist/garden-ui.esm.js +41 -4
  181. package/ui/preview/dist/garden-ui.iife.js +41 -4
  182. package/ui/prompt/rules.md +28 -1
  183. package/ui/react/components/chart.tsx +1 -1
  184. package/ui/react/components/display.tsx +1 -1
  185. package/ui/react/lang.tsx +4 -0
  186. package/ui/react/parity.tsx +8 -6
  187. package/worker/index.ts +8 -2
@@ -1,30 +1,221 @@
1
1
  ---
2
2
  title: 组件总览
3
3
  navTitle: 组件总览
4
- description: 9 个内置 garden 组件的用途、围栏名称与使用约束。
4
+ description: 12 个内置组件的效果预览。
5
5
  section: components
6
6
  order: 30
7
7
  ---
8
8
 
9
- 这 9 个组件都可以先在 `garden` 想法块里用一句话描述,交给 Agent 按 `garden-ui` skill 生成(详见 [用 AI 写作](/garden/ai-writing))。手写时使用 ```` ```garden <name> ```` 代码块插入,组件名固定为英文(`card`、`stat`、`compare`、`timeline`、`chart`、`figure`、`html`、`interactive`、`file`),参数采用 YAML 格式,`interactive` 则在 `---` 下方编写声明式标签。
9
+ ## [知识卡片 · card](/garden/components/card)
10
10
 
11
- ## 9 个组件速查表
11
+ ```garden card
12
+ title: SQLite WAL 写入模式
13
+ url: https://www.sqlite.org/wal.html
14
+ meta: 文档说明 · sqlite.org
15
+ description: 把修改先顺序追加到预写日志,读操作继续访问原数据库页,减少读写互斥等待。
16
+ points:
17
+ - 写入只追加到 `-wal` 文件末尾,不需要在事务提交时原地覆盖数据页。
18
+ - 读事务记录当前末尾偏移量即可看到一致快照,不会阻塞并发写入。
19
+ ```
12
20
 
13
- | 组件名 | 代码块围栏 | 适用场景 | 必填字段或下限 |
14
- | :--- | :--- | :--- | :--- |
15
- | [知识卡片](/garden/components/card) | ```` ```garden card ```` | 介绍论文、开源项目或模块要点 | 至少填 `description` 或 `points` |
16
- | [数字指标](/garden/components/stat) | ```` ```garden stat ```` | 并排展示 2~4 组关键数值与单位 | 每项必填 `label` 与 `value` |
17
- | [并排对比](/garden/components/compare) | ```` ```garden compare ```` | 左右并列对比 2~3 种方案或改动前后差异 | `items` 至少 2 项,每格不超过约 60 字 |
18
- | [时间线](/garden/components/timeline) | ```` ```garden timeline ```` | 按先后顺序串联排查记录或演进阶段 | `items` 至少 2 项 |
19
- | [条形图表](/garden/components/chart) | ```` ```garden chart ```` | 用数据绘制比例条形图(自带可展开数据表) | `data` 至少 2 行 |
20
- | [分区结构图](/garden/components/figure) | ```` ```garden figure ```` | 带分区按钮高亮与说明的 SVG / 图片结构图 | `svg` 或 `image` 二选一 |
21
- | [嵌入网页片段](/garden/components/html) | ```` ```garden html ```` | 在沙盒 `iframe` 中运行独立 HTML/JS 演示 | `src` 或 `code` 二选一 |
22
- | [可调公式与参数](/garden/components/interactive) | ```` ```garden interactive ```` | 提供滑杆或单选控件实时计算非平凡公式 | 含输入控件且公式不能是单次乘法 |
23
- | [文件下载与预览](/garden/components/file) | ```` ```garden file ```` | 提供本地或远程文件下载与页内预览 | `src` 或 `files` 二选一 |
21
+ ## [数字指标 · stat](/garden/components/stat)
24
22
 
25
- ## 编写与检查规则
23
+ ```garden stat
24
+ items:
25
+ - label: 正文列宽
26
+ value: "740"
27
+ unit: px
28
+ caption: 默认阅读列宽度
29
+ - label: 宽图上限
30
+ value: "1040"
31
+ unit: px
32
+ caption: 左右各最多外扩 150px
33
+ - label: 宽表上限
34
+ value: "1340"
35
+ unit: px
36
+ caption: 左右各最多外扩 300px
37
+ ```
26
38
 
27
- 1. **优先使用标准 Markdown**:普通文字说明、有序列表和常规对比表格直接用 Markdown 编写,只有结构化组件能明显提升可读性时才用 `garden` 围栏。
28
- 2. **不要重复展示同一组数据**:`chart` 组件下方自带「查看数据表」折叠区,同一小节内不需要再重复手写一张相同数据的 Markdown 表格。
29
- 3. **支持行内格式**:各组件的 `text`、`description`、`caption`、`points` 等文本字段均支持行内 `**加粗**`、`` `行内代码` `` 和 `<u>荧光笔下划线</u>`。
30
- 4. **本地预览全部组件样式**:运行 `npx garden ui catalog` 会在 `.garden/ui-catalog.html` 生成组件画廊页面,可在浏览器中直接打开查看。
39
+ ## [并排对比 · compare](/garden/components/compare)
40
+
41
+ ```garden compare
42
+ items:
43
+ - title: 写一句话说明改了什么
44
+ text: 想法块紧跟在完整代码下面,AI 把它换成 diff,页面合成「代码 / 对比上一版」。
45
+ - title: 手写 diff
46
+ text: 完整代码下面紧跟一段 diff。
47
+ ```
48
+
49
+ ## [时间线 · timeline](/garden/components/timeline)
50
+
51
+ ```garden timeline
52
+ items:
53
+ - date: 步骤 1
54
+ title: 同步内容与静态资源
55
+ text: 校验 Front Matter、复制图片附件并生成搜索索引与 RSS。
56
+ - date: 步骤 2
57
+ title: 构建静态站点产物
58
+ text: 把全部路由预渲染到静态目录。
59
+ ```
60
+
61
+ ## [条形图表 · chart](/garden/components/chart)
62
+
63
+ ```garden chart
64
+ title: 三种版面区域的宽度上限
65
+ xLabel: 版面区域
66
+ yLabel: 最大宽度
67
+ unit: px
68
+ data:
69
+ - x: 普通正文列
70
+ y: 740
71
+ - x: 宽幅配图区
72
+ y: 1040
73
+ - x: 多列宽表格
74
+ y: 1340
75
+ ```
76
+
77
+ ## [分区结构图 · figure](/garden/components/figure)
78
+
79
+ ```garden figure
80
+ svg: |
81
+ <svg viewBox="0 0 560 194" xmlns="http://www.w3.org/2000/svg" font-family="var(--sans)" style="max-width: 380px; margin-inline: auto">
82
+ <rect data-p="sync" x="2" y="4" width="180" height="186" rx="16" fill="var(--card)" stroke="var(--rule-strong)" stroke-width="2.5"/>
83
+ <text data-p="sync" x="92" y="42" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">1. garden</text>
84
+ <text data-p="sync" x="92" y="72" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">sync</text>
85
+ <text data-p="sync" x="92" y="108" text-anchor="middle" font-size="24" fill="var(--muted)">解析</text>
86
+ <text data-p="sync" x="92" y="137" text-anchor="middle" font-size="24" fill="var(--muted)">Markdown 与</text>
87
+ <text data-p="sync" x="92" y="166" text-anchor="middle" font-size="24" fill="var(--muted)">图片尺寸</text>
88
+ <path d="M183.5 97 H188.5" stroke="var(--muted)" stroke-width="2.5"/>
89
+ <rect data-p="build" x="190" y="4" width="180" height="186" rx="16" fill="var(--card)" stroke="var(--rule-strong)" stroke-width="2.5"/>
90
+ <text data-p="build" x="280" y="42" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">2. garden</text>
91
+ <text data-p="build" x="280" y="72" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">build</text>
92
+ <text data-p="build" x="280" y="108" text-anchor="middle" font-size="24" fill="var(--muted)">生成静态页面</text>
93
+ <text data-p="build" x="280" y="137" text-anchor="middle" font-size="24" fill="var(--muted)">与搜索索引</text>
94
+ <path d="M371.5 97 H376.5" stroke="var(--muted)" stroke-width="2.5"/>
95
+ <rect data-p="validate" x="378" y="4" width="180" height="186" rx="16" fill="var(--card)" stroke="var(--rule-strong)" stroke-width="2.5"/>
96
+ <text data-p="validate" x="468" y="42" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">3. pages:</text>
97
+ <text data-p="validate" x="468" y="72" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">validate</text>
98
+ <text data-p="validate" x="468" y="108" text-anchor="middle" font-size="24" fill="var(--muted)">检查导出目录</text>
99
+ </svg>
100
+ parts:
101
+ - id: sync
102
+ label: 1. 同步内容
103
+ text: 扫描正文与附件,生成站点数据。
104
+ - id: build
105
+ label: 2. 构建页面
106
+ text: 预渲染所有页面路由,输出 RSS、sitemap 与搜索文件。
107
+ - id: validate
108
+ label: 3. 导出校验
109
+ text: 确认导出目录结构完整。
110
+ ```
111
+
112
+ ## [嵌入网页片段 · html](/garden/components/html)
113
+
114
+ ```garden html
115
+ title: 字符长度小工具
116
+ code: |
117
+ <!doctype html>
118
+ <html lang="zh-CN">
119
+ <head>
120
+ <meta charset="utf-8" />
121
+ <style>
122
+ body { margin: 0; padding: 16px 18px; font: 14px/1.6 system-ui, sans-serif; color: #1b1a18; background: #faf9f5; }
123
+ input { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid #d5d1c8; border-radius: 6px; font: inherit; background: #fff; color: #1b1a18; }
124
+ .meta { margin-top: 10px; color: #6e6b64; font-variant-numeric: tabular-nums; }
125
+ strong { color: #1b1a18; }
126
+ </style>
127
+ </head>
128
+ <body>
129
+ <input id="txt" value="把文章放在自己的 Git 仓库里,推送后自动构建。" aria-label="输入示例文本" />
130
+ <div class="meta">当前字符数:<strong id="count">23</strong> 字</div>
131
+ <script>
132
+ const input = document.getElementById("txt");
133
+ const count = document.getElementById("count");
134
+ input.addEventListener("input", () => { count.textContent = String(input.value.length); });
135
+ </script>
136
+ </body>
137
+ </html>
138
+ ```
139
+
140
+ ## [可调公式与参数 · interactive](/garden/components/interactive)
141
+
142
+ ```garden interactive #overview-reading
143
+ caption: 示例:按字数和阅读速度估算阅读时间。
144
+ ---
145
+ <State words={6000} speed={400} />
146
+ <Let minutes={round(words / speed)} />
147
+
148
+ <Slider bind="words" label="正文字数" min={1000} max={20000} step={500} unit="字" />
149
+ <Slider bind="speed" label="阅读速度" min={200} max={800} step={50} unit="字/分钟" />
150
+
151
+ <Stat label="预计阅读时间" value={minutes} unit="分钟" />
152
+ ```
153
+
154
+ ## [文件下载与预览 · file](/garden/components/file)
155
+
156
+ ```garden file
157
+ src: ./components/file/checklist.md
158
+ title: 发布前检查清单
159
+ note: 可点击「预览」在当前页展开阅读,或直接下载原文件
160
+ ```
161
+
162
+ ## [关系图 · relations](/garden/components/relations)
163
+
164
+ ```garden relations
165
+ items:
166
+ - title: 选书
167
+ text: 定下这个月读什么
168
+ - title: 共读
169
+ text: 每周读完约定的章节
170
+ - title: 讨论
171
+ text: 见面聊各自的看法
172
+ - title: 复盘
173
+ text: 记下下次要改的地方
174
+ links:
175
+ - from: 1
176
+ to: 2
177
+ - from: 2
178
+ to: 3
179
+ - from: 3
180
+ to: 4
181
+ - from: 4
182
+ to: 1
183
+ - from: 3
184
+ to: 1
185
+ style: dashed
186
+ label: 影响选书
187
+ ```
188
+
189
+ ## [图标列表 · list](/garden/components/list)
190
+
191
+ ```garden list
192
+ items:
193
+ - icon: search
194
+ text: 搜索这个月的书名
195
+ - icon: eye
196
+ text: 看了 3 篇书评
197
+ - icon: heart
198
+ text: 收藏了活动页面
199
+ - icon: chat
200
+ text: 在群里问能不能只听不说
201
+ ```
202
+
203
+ ## [选择卡 · choice](/garden/components/choice)
204
+
205
+ ```garden choice
206
+ title: 下个月在哪里见面?
207
+ items:
208
+ - icon: idea
209
+ value: ¥40 / 人
210
+ text: 街角咖啡馆,含一杯饮料
211
+ label: 更看重氛围
212
+ reply: 选了咖啡馆。我们会提前订好靠窗的长桌。
213
+ - icon: book
214
+ value: 免费
215
+ text: 社区图书馆活动室,需提前预约
216
+ label: 更看重安静
217
+ reply: 选了图书馆。我们会在月初提交预约。
218
+ none:
219
+ label: 都不合适 / 说不清
220
+ reply: 没关系,我们会在群里再列几个场地。
221
+ ```
@@ -43,6 +43,8 @@ pages:
43
43
  thoughts:
44
44
  title: 随想
45
45
  subtitle: 短笔记、图片和链接。
46
+ # 每屏显示多少条,往下读时自动加载下一屏。默认 10。
47
+ # pageSize: 10
46
48
  columns:
47
49
  title: 专栏
48
50
  subtitle: 按顺序读的一组文章。
@@ -75,7 +77,7 @@ footer: 持续记录。
75
77
  | `name` | 站点名称,显示在左上角导航栏、浏览器标题后缀与 RSS 订阅源标题 |
76
78
  | `tagline` | 站点副标题 |
77
79
  | `description` | 站点简介,用于首页 SEO 描述与 RSS 频道描述 |
78
- | `locale` | 语言与地区标识,默认写 `zh_CN`(下划线格式) |
80
+ | `locale` | 语言与地区标识,默认写 `zh_CN`(下划线格式);设为 `en_US` 时,全站框架文案(导航、首页、文章列表、文章元信息与永久链接、Giscus 评论提示、标签、专栏、关于页、404 页面、分页、RSS/sitemap 与 meta/og)会在构建时切换为英文 |
79
81
  | `url` | 站点的公开完整网址(如 `https://blog.example.com`)。配置后,文章里指向该地址的完整链接会自动按站内链接处理 |
80
82
  | `author.name` | 作者署名,显示在文章元信息栏、关于页和页脚 |
81
83
  | `author.github` | GitHub 用户名(不要写完整网址),用于拼接 GitHub 主页链接及拉取关于页的公开动态 |
@@ -107,7 +109,7 @@ footer: 持续记录。
107
109
  columns:
108
110
  - slug: building-in-public
109
111
  title: 一个人造产品
110
- status: 连载中
112
+ status: ongoing
111
113
  description: 从最小闭环到验证发布的完整记录。
112
114
  cover: windowsill-herbs.svg
113
115
  posts:
@@ -120,6 +122,6 @@ columns:
120
122
  | `slug` | 是 | 专栏标识,只能包含小写字母、数字和连字符,生成路由 `/columns/<slug>/<post>` |
121
123
  | `title` | 是 | 专栏名称(同时会显示在 `/blog` 文章列表对应文章的右侧) |
122
124
  | `description` | 是 | 专栏简介,显示在 `/columns` 列表卡片上 |
123
- | `status` | 否 | 状态文字(如 `连载中` 或 `已完结`) |
125
+ | `status` | 否 | 状态标识:`default`(或不写,显示为「持续更新」)、`ongoing`(「连载中」)、`completed`(「已完结」);旧写法 `持续更新`、`连载中`、`已完结` 仍可识别,其他文字按原样显示 |
124
126
  | `cover` | 否 | 专栏封面图路径(相对 `content/covers/`) |
125
127
  | `posts` | 是 | 按阅读顺序排列的文章路径列表(相对于 `content/posts/`,不带 `.md` 后缀) |
@@ -6,7 +6,7 @@ section: getting-started
6
6
  order: 4
7
7
  ---
8
8
 
9
- `npx hd-garden init` 不会自动创建 `.github/workflows/pages.yml`。发布到 GitHub Pages 时,在站点仓库新建这个文件。同一份工作流同时支持**单个公开仓库**和**私有源码仓库 + 公开页面仓库**两种模式,按 `PAGES_REPOSITORY` 变量是否为空自动切换。
9
+ 默认中文初始化(`npx hd-garden init`)不会自动创建 `.github/workflows/pages.yml`(使用 `--locale en` 或 `--locale en_US` 初始化英文站点时会自动安装英文工作流模板)。发布到 GitHub Pages 时,在站点仓库新建或检查这个文件。同一份工作流同时支持**单个公开仓库**和**私有源码仓库 + 公开页面仓库**两种模式,按 `PAGES_REPOSITORY` 变量是否为空自动切换。
10
10
 
11
11
  下面的工作流和 Garden 仓库自己的 `.github/workflows/pages.yml` 一致,改动只有两处:一是去掉只对 Garden 仓库有用的 `paths-ignore`、`npm run lint` 和 `npm test`;二是 `publish-repository` 任务先装依赖,再用 `npx garden pages:prepare static-site pages-repository` 写入公开仓库(Garden 仓库里直接调用的是同一个脚本 `scripts/prepare-pages-output.mjs`)。`npm ci` 需要仓库里有 `package-lock.json`,第一次 `npm install` 后记得一起提交。
12
12
 
@@ -36,18 +36,26 @@ Garden 的文章页面围绕长文阅读体验做了几项自动化处理。这
36
36
  ```garden figure
37
37
  caption: 点击上方按钮查看图片从构建到渲染的三个阶段
38
38
  svg: |
39
- <svg viewBox="0 0 680 110" xmlns="http://www.w3.org/2000/svg" font-family="var(--sans)">
40
- <rect data-p="sync" x="12" y="18" width="196" height="74" rx="10" fill="var(--card)" stroke="var(--rule-strong)" stroke-width="1.5"/>
41
- <text data-p="sync" x="110" y="50" text-anchor="middle" font-size="14" font-weight="600" fill="var(--ink)">1. 构建期读取尺寸</text>
42
- <text data-p="sync" x="110" y="72" text-anchor="middle" font-size="12" fill="var(--muted)">写入 width / height 与 --wl</text>
43
- <path d="M214 55 H236" stroke="var(--muted)" stroke-width="1.5"/>
44
- <rect data-p="measure" x="242" y="18" width="196" height="74" rx="10" fill="var(--card)" stroke="var(--rule-strong)" stroke-width="1.5"/>
45
- <text data-p="measure" x="340" y="50" text-anchor="middle" font-size="14" font-weight="600" fill="var(--ink)">2. 客户端测量拓宽</text>
46
- <text data-p="measure" x="340" y="72" text-anchor="middle" font-size="12" fill="var(--muted)">按当前视口调整宽图与目录</text>
47
- <path d="M444 55 H466" stroke="var(--muted)" stroke-width="1.5"/>
48
- <rect data-p="dark" x="472" y="18" width="196" height="74" rx="10" fill="var(--card)" stroke="var(--rule-strong)" stroke-width="1.5"/>
49
- <text data-p="dark" x="570" y="50" text-anchor="middle" font-size="14" font-weight="600" fill="var(--ink)">3. 深色衬底与灯箱</text>
50
- <text data-p="dark" x="570" y="72" text-anchor="middle" font-size="12" fill="var(--muted)">深色垫 #faf9f5 · 点击放大</text>
39
+ <svg viewBox="0 0 560 194" xmlns="http://www.w3.org/2000/svg" font-family="var(--sans)" style="max-width: 380px; margin-inline: auto">
40
+ <rect data-p="sync" x="2" y="4" width="180" height="186" rx="16" fill="var(--card)" stroke="var(--rule-strong)" stroke-width="2.5"/>
41
+ <text data-p="sync" x="92" y="42" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">1. 构建期</text>
42
+ <text data-p="sync" x="92" y="72" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">读取尺寸</text>
43
+ <text data-p="sync" x="92" y="108" text-anchor="middle" font-size="24" fill="var(--muted)">写入 width /</text>
44
+ <text data-p="sync" x="92" y="137" text-anchor="middle" font-size="24" fill="var(--muted)">height 与 --wl</text>
45
+ <path d="M183.5 97 H188.5" stroke="var(--muted)" stroke-width="2.5"/>
46
+ <rect data-p="measure" x="190" y="4" width="180" height="186" rx="16" fill="var(--card)" stroke="var(--rule-strong)" stroke-width="2.5"/>
47
+ <text data-p="measure" x="280" y="42" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">2. 客户端</text>
48
+ <text data-p="measure" x="280" y="72" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">测量拓宽</text>
49
+ <text data-p="measure" x="280" y="108" text-anchor="middle" font-size="24" fill="var(--muted)">按当前视口</text>
50
+ <text data-p="measure" x="280" y="137" text-anchor="middle" font-size="24" fill="var(--muted)">调整宽图</text>
51
+ <text data-p="measure" x="280" y="166" text-anchor="middle" font-size="24" fill="var(--muted)">与目录</text>
52
+ <path d="M371.5 97 H376.5" stroke="var(--muted)" stroke-width="2.5"/>
53
+ <rect data-p="dark" x="378" y="4" width="180" height="186" rx="16" fill="var(--card)" stroke="var(--rule-strong)" stroke-width="2.5"/>
54
+ <text data-p="dark" x="468" y="42" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">3. 深色衬底</text>
55
+ <text data-p="dark" x="468" y="72" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">与灯箱</text>
56
+ <text data-p="dark" x="468" y="108" text-anchor="middle" font-size="24" fill="var(--muted)">深色垫</text>
57
+ <text data-p="dark" x="468" y="137" text-anchor="middle" font-size="24" fill="var(--muted)">#faf9f5 ·</text>
58
+ <text data-p="dark" x="468" y="166" text-anchor="middle" font-size="24" fill="var(--muted)">点击放大</text>
51
59
  </svg>
52
60
  parts:
53
61
  - id: sync
@@ -86,8 +86,8 @@ Following the `garden-ui` skill, the Agent replaces that idea fence with a `diff
86
86
 
87
87
  When writing components by hand without AI, you can use the templates and snippets shipped in the package:
88
88
 
89
- - Every draft created by `make new` includes an HTML comment at the bottom with copy-ready examples for idea fences and all 9 components; delete the comment whenever you are done.
90
- - `templates/garden-blocks.md` lists `when` / `whenNot` guidance and copyable templates for every block; macOS, Typora, and Alfred users can import `templates/garden-snippets.plist` to expand `;gidea`, `;gcard`, `;gstat`, `;gcompare`, `;gtimeline`, `;gchart`, `;gfigure`, `;ghtml`, `;ginteractive`, and `;gfile`.
89
+ - Every draft created by `make new` includes an HTML comment at the bottom with copy-ready examples for idea fences and all 12 components; delete the comment whenever you are done.
90
+ - `templates/garden-blocks.md` lists `when` / `whenNot` guidance and copyable templates for every block; macOS, Typora, and Alfred users can import `templates/garden-snippets.plist` to expand `;gidea`, `;gcard`, `;gstat`, `;gcompare`, `;gtimeline`, `;gchart`, `;gfigure`, `;ghtml`, `;ginteractive`, `;gfile`, `;grel`, `;glist`, and `;gchoice`.
91
91
  - The engine repository also ships editor integrations under `editors/vscode`, `editors/typora`, and `editors/obsidian`, and `npx garden ui catalog` generates an offline component catalog at `.garden/ui-catalog.html`.
92
92
 
93
93
  ## 7. Optional Standalone Admin
@@ -7,8 +7,6 @@ order: 31
7
7
  badge: card
8
8
  ---
9
9
 
10
- Write "add a `card` summarizing the SQLite WAL documentation with a title, link, and three takeaways" inside a `garden` idea block, and the Agent generates the `garden card` block below via the `garden-ui` skill (hand-written syntax follows).
11
-
12
10
  ```garden card
13
11
  title: SQLite Write-Ahead Logging
14
12
  url: https://www.sqlite.org/wal.html
@@ -20,27 +18,50 @@ points:
20
18
  - Background checkpoints copy log pages back into the main database file in batches once a threshold is reached.
21
19
  ```
22
20
 
21
+ - **When to use**: Introducing a paper, open-source project, or subsystem where a link and 2 to 4 numbered points belong together, or listing several tools or references with a takeaway line.
22
+ - **When to skip**: A sentence or two of prose or a `[Title](url){card}` link card is enough.
23
+
24
+ You can tell the AI:
25
+
23
26
  ````markdown
27
+ ```garden
28
+ Summarize the SQLite WAL documentation in a card with a link, a one-sentence summary, and three takeaways.
29
+ ```
30
+ ````
31
+
32
+ ## Multiple Resource Row Cards (`cards`)
33
+
34
+ When you want to list several projects, tools, or references in one block and attach a takeaway line to each, use `cards`:
35
+
24
36
  ```garden card
25
- title: SQLite Write-Ahead Logging
26
- url: https://www.sqlite.org/wal.html
27
- meta: Documentation · sqlite.org
28
- description: Appends changes sequentially to a write-ahead log while readers continue reading the original database pages, reducing read-write contention.
29
- points:
30
- - Writes append to the end of the `-wal` file instead of overwriting database pages in place on commit.
31
- - Readers record the current end-of-log mark to see a consistent snapshot without blocking concurrent writers.
32
- - Background checkpoints copy log pages back into the main database file in batches once a threshold is reached.
37
+ cards:
38
+ - url: https://openlibrary.org/
39
+ title: "Open Library: one page per book"
40
+ description: An open catalogue run by the Internet Archive, with editions and e-book loans.
41
+ image: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 132 132'%3E%3Crect width='132' height='132' fill='%23F0EEE6'/%3E%3Crect x='34' y='26' width='64' height='84' rx='6' fill='%23C9B79C'/%3E%3Crect x='34' y='26' width='10' height='84' fill='%238B6A45'/%3E%3Crect x='52' y='44' width='34' height='5' rx='2' fill='%23FAF9F5'/%3E%3Crect x='52' y='54' width='24' height='5' rx='2' fill='%23FAF9F5'/%3E%3C/svg%3E"
42
+ alt: A closed book
43
+ source:
44
+ - https://openlibrary.org/
45
+ takeaway: "**Worth borrowing:** link the book's page when you pick, so everyone reads the same edition."
46
+ - url: https://www.gutenberg.org/
47
+ title: "Project Gutenberg: public-domain e-books"
48
+ description: E-books that have entered the public domain, free to download.
49
+ image: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 132 132'%3E%3Crect width='132' height='132' fill='%23E8EEF0'/%3E%3Ccircle cx='66' cy='60' r='30' fill='%239DB7A8'/%3E%3Crect x='30' y='98' width='72' height='8' rx='4' fill='%233F6B55'/%3E%3Crect x='44' y='112' width='44' height='6' rx='3' fill='%239DB7A8'/%3E%3C/svg%3E"
50
+ alt: A desk lamp
51
+ source:
52
+ - https://www.gutenberg.org/
53
+ - https://en.wikipedia.org/wiki/Project_Gutenberg
54
+ takeaway: "**Worth borrowing:** pick a public-domain book now and then, so people without a copy can join at once."
55
+ ```
56
+
57
+ You can tell the AI:
58
+
59
+ ````markdown
60
+ ```garden
61
+ List Open Library and Project Gutenberg as two cards, each with a source link and a takeaway line on what is worth borrowing.
33
62
  ```
34
63
  ````
35
64
 
36
- - **Use when**: Introducing a paper, open-source project, or subsystem where a source link and 2 to 4 numbered points belong together.
37
- - **Skip when**: A sentence or two of prose or a `[Title](url "{card}")` link card is enough.
38
-
39
- | Field | Required | Type | Description |
40
- | :--- | :--- | :--- | :--- |
41
- | `title` | Recommended | string | Card heading |
42
- | `url` | No | full URL | External link shown next to the heading |
43
- | `meta` | No | string | Subtitle or metadata line below the heading |
44
- | `description` | Either this or `points` | string | Main summary paragraph (supports inline bold and code) |
45
- | `points` | Either this or `description` | string[] | Numbered list of takeaways below the summary |
46
- | `source` | No | string or `{ title, url }` | Source attribution in the bottom-right corner |
65
+ ## Fields
66
+
67
+ Every field, default, limit and error code is in [Component reference · card](/garden/en/reference/card).
@@ -1,14 +1,12 @@
1
1
  ---
2
2
  title: Bar Chart (chart)
3
3
  navTitle: chart
4
- description: Render proportional horizontal bars from YAML data, with a built-in expandable table underneath.
4
+ description: Render proportional horizontal bars with a built-in expandable data table underneath.
5
5
  section: components
6
6
  order: 35
7
7
  badge: chart
8
8
  ---
9
9
 
10
- Write "use `chart` to compare the max widths of the prose column, wide figures, and wide tables" inside a `garden` idea block, and the Agent generates the `garden chart` block below via the `garden-ui` skill (hand-written syntax follows).
11
-
12
10
  ```garden chart
13
11
  title: Max Width by Layout Zone
14
12
  xLabel: Layout Zone
@@ -24,31 +22,17 @@ data:
24
22
  caption: Click "View data table" below to expand the full numeric table.
25
23
  ```
26
24
 
25
+ - **When to use**: Comparing the relative magnitudes of 2 to 8 values that share the same unit.
26
+ - **When to skip**: Numbers change with reader input (use [`interactive`](/garden/en/components/interactive)), or you already have a Markdown table with the same numbers in that section (the chart includes its own expandable table).
27
+
28
+ You can tell the AI:
29
+
27
30
  ````markdown
28
- ```garden chart
29
- title: Max Width by Layout Zone
30
- xLabel: Layout Zone
31
- yLabel: Max Width
32
- unit: px
33
- data:
34
- - x: Prose Column
35
- y: 740
36
- - x: Wide Figure Zone
37
- y: 1040
38
- - x: Wide Table Zone
39
- y: 1340
40
- caption: Click "View data table" below to expand the full numeric table.
31
+ ```garden
32
+ Compare the max widths of the prose column, wide figures, and wide tables with a horizontal bar chart.
41
33
  ```
42
34
  ````
43
35
 
44
- - **Use when**: Comparing the relative magnitudes of 2 to 8 values that share the same unit.
45
- - **Skip when**: You already have a Markdown table with the same numbers in that section (`chart` includes its own expandable table).
36
+ ## Fields
46
37
 
47
- | Field | Required | Type | Description |
48
- | :--- | :--- | :--- | :--- |
49
- | `title` | Recommended | string | Chart heading |
50
- | `data` | Yes | `{ x, y, label? }[]` (at least 2) | Data rows where `x` is the label and `y` is the numeric value |
51
- | `unit` | No | string | Unit suffix appended when a row does not specify its own `label` |
52
- | `xLabel` | No | string | Header for the first column of the expandable table |
53
- | `yLabel` | No | string | Header for the second column of the expandable table |
54
- | `caption` | No | string | Caption shown below the chart |
38
+ Every field, default, limit and error code is in [Component reference · chart](/garden/en/reference/chart).
@@ -0,0 +1,42 @@
1
+ ---
2
+ title: Choice Cards (choice)
3
+ navTitle: choice
4
+ description: Present two or three option cards with an icon, headline value, and preference label, plus an optional fallback button and selection reply.
5
+ section: components
6
+ order: 42
7
+ badge: choice
8
+ ---
9
+
10
+ ```garden choice
11
+ title: Where should we meet next month?
12
+ items:
13
+ - icon: idea
14
+ value: $6 each
15
+ text: Corner café, one drink included
16
+ label: Prefer the atmosphere
17
+ reply: Café it is. We will book the long table by the window.
18
+ - icon: book
19
+ value: Free
20
+ text: Library meeting room, booking needed
21
+ label: Prefer the quiet
22
+ reply: Library it is. We will book the room at the start of the month.
23
+ none:
24
+ label: Neither / not sure
25
+ reply: No problem. We will share a few more venues in the group chat.
26
+ caption: Illustrative only. Venues and prices are made up.
27
+ ```
28
+
29
+ - **When to use**: Offering two or three concrete options where each choice has an icon, a prominent number or price, and a short note.
30
+ - **When to skip**: Choosing an option recalculates a formula or updates a chart; use [`interactive`](/garden/en/components/interactive) instead.
31
+
32
+ You can tell the AI:
33
+
34
+ ````markdown
35
+ ```garden
36
+ Give readers two venue cards (corner cafe vs. library meeting room) with cost, preference label, selection reply, and a "neither" button underneath.
37
+ ```
38
+ ````
39
+
40
+ ## Fields
41
+
42
+ Every field, default, limit and error code is in [Component reference · choice](/garden/en/reference/choice).
@@ -1,14 +1,12 @@
1
1
  ---
2
2
  title: Side-by-Side Comparison (compare)
3
3
  navTitle: compare
4
- description: Place two or three options side by side to contrast tradeoffs and attributes.
4
+ description: Place two or three options side by side to contrast tradeoffs, or stack good and bad practices.
5
5
  section: components
6
6
  order: 33
7
7
  badge: compare
8
8
  ---
9
9
 
10
- Write "use `compare` to contrast describing a code change in one sentence against writing a diff block by hand" inside a `garden` idea block, and the Agent generates the `garden compare` block below via the `garden-ui` skill (hand-written syntax follows).
11
-
12
10
  ```garden compare
13
11
  items:
14
12
  - title: Describe the change in one sentence
@@ -17,22 +15,39 @@ items:
17
15
  text: Place a diff below full code; alone it raises diff-orphan.
18
16
  ```
19
17
 
18
+ - **When to use**: Comparing 2 or 3 options, configurations, or before/after behaviors side by side (up to ~60 characters per cell in side-by-side mode), or stacking anti-patterns and recommended practices.
19
+ - **When to skip**: Comparing more than 3 items or aligning multiple attributes across rows; use a Markdown list or table instead.
20
+
21
+ You can tell the AI:
22
+
20
23
  ````markdown
24
+ ```garden
25
+ Contrast describing a code change in one sentence against writing a diff block by hand.
26
+ ```
27
+ ````
28
+
29
+ ## Good vs. Bad Verdicts (`verdict: good | bad`)
30
+
31
+ When contrasting an anti-pattern with a recommended practice, adding `verdict: bad` or `verdict: good` stacks the items vertically and shows a red cross or green check beside each heading:
32
+
21
33
  ```garden compare
22
34
  items:
23
- - title: Describe the change in one sentence
24
- text: Idea block under full code; garden-ui writes the diff.
25
- - title: Write the diff by hand
26
- text: Place a diff below full code; alone it raises diff-orphan.
35
+ - title: A poor question
36
+ verdict: bad
37
+ text: "“Have you read this author's other books? Could you share a review?”"
38
+ - title: A better question
39
+ verdict: good
40
+ text: "“When do you usually read? Would you like to sit in once first?”"
41
+ ```
42
+
43
+ You can tell the AI:
44
+
45
+ ````markdown
46
+ ```garden
47
+ Contrast a poor question and a better question when welcoming a newcomer, marked as bad and good examples.
27
48
  ```
28
49
  ````
29
50
 
30
- - **Use when**: Comparing 2 or 3 options, configurations, or before/after behaviors side by side (keep each cell under ~60 characters).
31
- - **Skip when**: Comparing more than 3 items or aligning multiple attributes across rows; use a Markdown table instead.
51
+ ## Fields
32
52
 
33
- | Field | Required | Type | Description |
34
- | :--- | :--- | :--- | :--- |
35
- | `items` | Yes | array (at least 2) | Options to compare; each entry can also be a `"Title: description"` shorthand string |
36
- | `items[].title` | Recommended | string | Column heading |
37
- | `items[].text` | Recommended | string or string[] | Body description for the column |
38
- | `items[].<customKey>` | No | string or number | Extra key-value pairs rendered as attribute tags along the bottom of the card |
53
+ Every field, default, limit and error code is in [Component reference · compare](/garden/en/reference/compare).