hd-garden 0.4.0 → 0.4.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.
@@ -2,7 +2,7 @@
2
2
  name: garden-interactive-chart
3
3
  description: >-
4
4
  Writes Garden interactive charts as self-contained HTML in a same-name
5
- sidecar directory and embeds them with a short widget fence. Use when adding
5
+ sidecar directory and embeds them with a short garden html fence. Use when adding
6
6
  or editing Garden widgets, steppers, inspect grids, param benches,
7
7
  compare views, traces, KV cache charts, or any 可交互图表 / 同名目录 HTML.
8
8
  ---
@@ -41,9 +41,9 @@ content/posts/understand-kv-cache/waste.html
41
41
  正文:
42
42
 
43
43
  ````md
44
- ```widget
44
+ ```garden html
45
45
  src: ./understand-kv-cache/waste.html
46
- caption: 朴素 decode 每步重算全部过去 token;6 个 token 共 21 次计算,其中 15 次是浪费。
46
+ title: 朴素 decode 每步重算全部过去 token;6 个 token 共 21 次计算,其中 15 次是浪费。
47
47
  ```
48
48
  ````
49
49
 
@@ -51,7 +51,7 @@ caption: 朴素 decode 每步重算全部过去 token;6 个 token 共 21 次
51
51
 
52
52
  - `src` 必须是该同名目录里的本地 `.html` 或 `.pdf`,不能指到 `assets/`、别的文章或 `https://`
53
53
  - 带 `garden-chart` 高度回报的 HTML 是图表,直接铺开;普通 HTML 和 PDF 默认收成示意入口,读者展开后再加载
54
- - `caption` 必须是判断,不能是「见下图」
54
+ - `title` 必须是判断,不能是「见下图」
55
55
  - 一份 HTML 一张图;文件名用 `waste.html`、`stepper.html` 这种短 kebab
56
56
  - HTML 自包含:CSS、SVG、脚本都在这一个文件里
57
57
  - 先写 HTML,再写围栏;围栏里不要再摊步进数组或采样点
@@ -77,8 +77,8 @@ caption: 朴素 decode 每步重算全部过去 token;6 个 token 共 21 次
77
77
 
78
78
  ## 交稿前
79
79
 
80
- - [ ] 文件在同名目录内,围栏只有 `src` + `caption`
80
+ - [ ] 文件在同名目录内,围栏只有 `src` + `title`
81
81
  - [ ] 单独打开 HTML 就能用;iframe 能撑开高度
82
82
  - [ ] 浅色 / 深色主题都跟 Garden 纸面
83
83
  - [ ] 减少动态时不自动循环
84
- - [ ] `caption` 让关 JS 的人也能读到结论
84
+ - [ ] `title` 让关 JS 的人也能读到结论
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: garden-ui
3
3
  description: >-
4
- Compiles the intent blocks in one Garden post into ui blocks (or prose, or a
5
- widget), recompiles stale or broken ui blocks, and suggests where a post
4
+ Compiles the intent blocks in one Garden post into ui blocks (or prose, or
5
+ garden html), recompiles stale or broken ui blocks, and suggests where a post
6
6
  could use interaction. Use when the user says 编译这篇 / 编译意图块 / 重编译
7
7
  <id> / 这篇哪里适合交互, or pastes a garden ui check fix prompt.
8
8
  ---
@@ -43,7 +43,7 @@ description: >-
43
43
  3. 每块读原话和所在小节,三选一:
44
44
  - **写回正文**:一句话、一张表或一张 Mermaid 就能说清时。
45
45
  - **写 `ui`**:读者需要拖、点、翻才能看懂时。
46
- - **写 `widget`**:目录表达不了的画布动画、音频、物理模拟等。按 [garden-interactive-chart](../garden-interactive-chart/SKILL.md) 在同名目录写 HTML,并在 `widget` 的 YAML 里加 `intent:` 保留原话。
46
+ - **写 `garden html`**:目录表达不了的画布动画、音频、物理模拟等。按 [garden-interactive-chart](../garden-interactive-chart/SKILL.md) 在同名目录写 HTML,用 `title` 写下判断。
47
47
 
48
48
  4. 写 `ui` 时:
49
49
  - 原话原样放进块头的 `intent`,一个字都不改。`compiled` 不用写,`apply` 会写。
@@ -69,7 +69,7 @@ description: >-
69
69
  ````
70
70
 
71
71
  - 没写 id 的 `intent` 块用 `--intent-hash <intentHash>` 定位;原话重复时改用 `--at <startLine>`。
72
- - 新内容可以是一个 `ui` 围栏、一个 `widget` 围栏,或一段普通 Markdown(写回正文时)。
72
+ - 新内容可以是一个 `ui` 围栏、一个 `garden html` 围栏,或一段普通 Markdown(写回正文时)。
73
73
  - 成功时 stdout 是 `{"ok":true,...}`。失败时 stderr 是 JSON,按 `code` 处理:
74
74
  - `apply-invalid`:新内容没通过校验,按 `diagnostics` 改了再写。
75
75
  - `apply-base`:块在扫描之后被改过。重新 `scan`,用新的 `hash`。
@@ -99,7 +99,6 @@ export default async function PostPage({
99
99
  </time>
100
100
  </li>
101
101
  {post.updated ? <li>更新于 {formatDate(post.updated)}</li> : null}
102
- <li>{post.readingTime}</li>
103
102
  <li>约 {wordCount.toLocaleString("en-US")} 字</li>
104
103
  {post.topic ? (
105
104
  <li>
@@ -122,7 +122,6 @@ export default async function ColumnEntryPage({
122
122
  {formatDate(entry.date)}
123
123
  </time>
124
124
  </li>
125
- <li>{entry.readingTime}</li>
126
125
  {entry.topic && entry.topic !== entry.columnTitle ? (
127
126
  <li><a className="cat" href={`/blog?topic=${encodeURIComponent(entry.topic)}`}>{entry.topic}</a></li>
128
127
  ) : null}
@@ -8,6 +8,7 @@ import {
8
8
  } from "@garden/generated-content";
9
9
  import GithubSlugger from "github-slugger";
10
10
  import { canonicalSiteDate } from "../../scripts/site-date.mjs";
11
+ import { demoDateLabel } from "./a2-meta";
11
12
  import { contentToSearchText } from "../../ui/core/transform.mjs";
12
13
  import { toString } from "mdast-util-to-string";
13
14
  import remarkParse from "remark-parse";
@@ -26,6 +27,7 @@ export const columnHref = (entry: Pick<ContentEntry, "column" | "path">) =>
26
27
  `/columns/${entry.column}/${columnEntryPath(entry)}`;
27
28
 
28
29
  export const formatDate = (value: string, withTime = false) => {
30
+ if (!withTime) return demoDateLabel(value);
29
31
  const canonical = canonicalSiteDate(value) ?? value;
30
32
  const date = new Date(canonical);
31
33
  if (Number.isNaN(date.getTime())) return value;
@@ -34,7 +36,8 @@ export const formatDate = (value: string, withTime = false) => {
34
36
  year: "numeric",
35
37
  month: "2-digit",
36
38
  day: "2-digit",
37
- ...(withTime ? { hour: "2-digit", minute: "2-digit" } : {}),
39
+ hour: "2-digit",
40
+ minute: "2-digit",
38
41
  }).format(date);
39
42
  };
40
43
 
package/app/page.tsx CHANGED
@@ -49,7 +49,7 @@ export default function Home() {
49
49
  {posts.length > 0 && feature ? (
50
50
  <article className="sh-feature" aria-labelledby="ft">
51
51
  {feature.cover ? (
52
- <div className="cover" style={{ background: "var(--cover)" }}>
52
+ <div className="cover">
53
53
  {/* eslint-disable-next-line @next/next/no-img-element */}
54
54
  <img src={feature.cover} alt="" />
55
55
  </div>
@@ -134,7 +134,8 @@ html[data-theme="dark"] .sh-rail{color:var(--muted)}
134
134
  .sh-intro .links a:hover{color:var(--blue);text-decoration-color:currentColor}
135
135
  .sh-feature{position:relative;display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:48px;align-items:center;margin:56px 0 0}
136
136
  .sh-feature:not(:has(.cover)){grid-template-columns:minmax(0,1fr)}
137
- .sh-feature .cover{border-radius:var(--r-lg);aspect-ratio:16/9;display:flex;align-items:center;justify-content:center;overflow:hidden}
137
+ .sh-feature .cover{border-radius:var(--r-lg);aspect-ratio:auto;display:block;overflow:hidden;background:none}
138
+ .sh-feature .cover img{display:block;width:100%;height:auto}
138
139
  .sh-feature .cover .cover-art{height:86%;width:auto}
139
140
  .sh-feature .kicker{display:flex;flex-wrap:wrap;gap:4px 14px;font-size:var(--fs-small);color:var(--muted);margin:0 0 12px}
140
141
  .sh-feature h2{font:700 30px/1.35 var(--sans);color:var(--ink);margin:0;text-wrap:balance}
@@ -271,7 +272,6 @@ html[data-theme="dark"] .sh-pal-scrim{background:rgba(0,0,0,.55)}
271
272
  .sh-intro{padding:44px 0 0}
272
273
  .sh-intro p{font-size:var(--fs-body)}
273
274
  .sh-feature{grid-template-columns:minmax(0,1fr);gap:20px;margin-top:36px}
274
- .sh-feature .cover{border-radius:16px}
275
275
  .sh-feature h2{font-size:24px}
276
276
  .sh-section{margin-top:56px}
277
277
  .sh-cols{grid-template-columns:minmax(0,1fr);gap:16px}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hd-garden",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "private": false,
5
5
  "description": "用 Markdown 写作、用 GitHub Pages 发布的个人博客引擎。",
6
6
  "license": "MIT",