pi-auto-save-to-markdown 0.9.1 → 0.9.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.
- package/README.md +42 -8
- package/README.zh.md +48 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -150,27 +150,60 @@ I'll trace the middleware order first.
|
|
|
150
150
|
````
|
|
151
151
|
|
|
152
152
|
The body renders user and assistant messages in full (assistant thinking and
|
|
153
|
-
per-turn tool calls are each folded into a collapsed
|
|
153
|
+
per-turn tool calls are each folded into a collapsed callout —
|
|
154
154
|
`> [!tldr]- Thinking` and `> [!quote]- Tool Calls · …`), recording every tool
|
|
155
155
|
call with its full raw result: the file is a documentary record that may be
|
|
156
156
|
@-referenced back into a conversation, and a truncated half-result would be
|
|
157
157
|
wasted when the tool is called again and misleading when it is not, while
|
|
158
158
|
local reading (grep, ranged reads) makes size a non-issue. Callouts are used
|
|
159
|
-
instead of HTML `<details>` because
|
|
160
|
-
|
|
159
|
+
instead of HTML `<details>` because a callout is plain markdown — meaningful
|
|
160
|
+
in every renderer, a panel where supported and a blockquote everywhere else —
|
|
161
|
+
whereas raw HTML blocks have no such portability: Obsidian does not parse
|
|
162
|
+
markdown inside HTML blocks, and neither does Quartz's remark/CommonMark
|
|
163
|
+
pipeline (invalid HTML there can even break a page outright), so `<details>`
|
|
164
|
+
cannot be relied on to carry content across the tools these files are read in.
|
|
161
165
|
Arguments render as full JSON in inline code spans and results verbatim —
|
|
162
166
|
whitespace intact, nothing capped — in fenced code blocks (with a delimiter
|
|
163
167
|
sized to survive backticks inside the content), so raw tool output renders
|
|
164
168
|
literally instead of being parsed as markdown.
|
|
165
169
|
|
|
170
|
+
### Callouts beyond Obsidian
|
|
171
|
+
|
|
172
|
+
A callout is a blockquote whose first line carries a type marker
|
|
173
|
+
(`> [!note] Title`): renderers that understand the marker draw a titled,
|
|
174
|
+
colored, optionally collapsible panel, and every other renderer still sees a
|
|
175
|
+
perfectly valid blockquote. Obsidian popularized the syntax and extends it
|
|
176
|
+
with fold markers (`-` collapsed, `+` expanded) and arbitrary types; GitHub
|
|
177
|
+
standardized a five-type subset of the same marker (`[!note]` …
|
|
178
|
+
`[!caution]`, no folding) as its "alerts". These files render best in
|
|
179
|
+
Obsidian — custom types and preset-collapsed folds included — but Obsidian is
|
|
180
|
+
far from the only viewer that draws the panels:
|
|
181
|
+
|
|
182
|
+
- **[Quartz](https://quartz.jzhao.xyz)** — the static-site generator for
|
|
183
|
+
publishing Obsidian vaults, renders the same callout syntax, folding
|
|
184
|
+
included.
|
|
185
|
+
- **VS Code** — extensions add the panels to the built-in markdown preview,
|
|
186
|
+
e.g. Markdown Obsidian Callout, vscode-markdown-obsidian-alert, or
|
|
187
|
+
Markdown GitHub Alerts & Obsidian Callouts.
|
|
188
|
+
- **Static-site pipelines** — remark plugins render callouts on the web:
|
|
189
|
+
remark-obsidian-callout (Astro and friends) parses the full Obsidian
|
|
190
|
+
syntax, remark-github-blockquote-alert the GitHub subset.
|
|
191
|
+
- **The standardized subset** — GitHub itself, Typora (opt-in), and Markdown
|
|
192
|
+
Preview Enhanced render GitHub's alert types; this plugin's `tldr`/`quote`
|
|
193
|
+
types and fold markers live outside that subset, so on those surfaces the
|
|
194
|
+
callouts fall back to plain — still perfectly readable — blockquotes,
|
|
195
|
+
exactly the graceful degradation the syntax was designed for.
|
|
196
|
+
|
|
166
197
|
Prompt blocks the client or the agent injects into a user message — the
|
|
167
198
|
editor's active selection, attached or referenced notes, loaded skills — are
|
|
168
|
-
re-rendered from their raw XML (which
|
|
169
|
-
as literal angle-bracket text) into generic
|
|
199
|
+
re-rendered from their raw XML (which markdown viewers cannot present
|
|
200
|
+
usefully — Obsidian shows it as literal angle-bracket text) into generic
|
|
201
|
+
callouts. No block is parsed
|
|
170
202
|
individually: the title is the tag name in words (`editor_selection` →
|
|
171
203
|
Editor Selection), and the body opens with vault-shaped `path`/`location`
|
|
172
|
-
values as bare
|
|
173
|
-
|
|
204
|
+
values as bare wikilinks (`[[…|alias]]` is a clickable link in Obsidian,
|
|
205
|
+
Quartz, and Markdown Preview Enhanced alike; the aliased filename speaks for
|
|
206
|
+
itself — no `path:` label), followed by the remaining attributes as
|
|
174
207
|
`**name**: value` items, then the content. Every callout is preset-collapsed
|
|
175
208
|
— user-provided blocks (selections, note attachments) as `> [!quote]-`, even
|
|
176
209
|
when they carry only attributes (the client emits note references as
|
|
@@ -204,7 +237,8 @@ Each message block opens with a setext level-1 info header (`User`,
|
|
|
204
237
|
content typically starts with, and distinguishable from content `#` headings
|
|
205
238
|
when parsing. The header's metadata (local date-time, and the model for
|
|
206
239
|
assistant messages) sits in a small faint `<span>` (`0.5em`, Obsidian's
|
|
207
|
-
`--text-faint` color
|
|
240
|
+
`--text-faint` color — renderers without the variable fall back to the
|
|
241
|
+
inherited text color), so the role stays visually dominant while the details
|
|
208
242
|
remain a glance away. Each block ends with a `---` separator wrapped in single
|
|
209
243
|
blank lines (extra blank lines are trimmed), so blocks are easy to tell apart
|
|
210
244
|
both when reading and when splitting the file programmatically. The document
|
package/README.zh.md
CHANGED
|
@@ -124,30 +124,57 @@ Assistant <span style="font-size: 0.5em; color: var(--text-faint);">2026-08-29 1
|
|
|
124
124
|
````
|
|
125
125
|
|
|
126
126
|
正文完整渲染 user / assistant 消息(assistant 的 thinking 与每轮工具调用
|
|
127
|
-
分别折叠在可折叠的
|
|
127
|
+
分别折叠在可折叠的 callout 中——`> [!tldr]- Thinking` 和
|
|
128
128
|
`> [!quote]- Tool Calls · …`),每次工具调用连同其完整原始结果一起记录:
|
|
129
129
|
归档文件是可能被 @ 引回对话的史料,截断的半个结果在工具重调时是浪费、在
|
|
130
130
|
不再调用时是误导,而局部阅读(grep、按行段读取)让体积不成问题。之所以用
|
|
131
|
-
callout 而不是 HTML `<details>`,是因为
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
131
|
+
callout 而不是 HTML `<details>`,是因为 callout 是纯 Markdown,在任何渲染器里
|
|
132
|
+
都是有效文本:支持的环境画出可折叠面板,不支持的环境退化为普通引用块;原始
|
|
133
|
+
HTML 块则没有这等待遇——Obsidian 不解析 HTML 块内嵌的 Markdown,Quartz
|
|
134
|
+
(remark/CommonMark 管线)同样如此,无效的 HTML 属性甚至能让整页渲染失败,
|
|
135
|
+
`<details>` 无法跨工具承载内容。参数以完整 JSON 包在 inline code 里,
|
|
136
|
+
结果逐字保真——空白原样、不截断——放在 fenced code block 中(分隔符长度会自动
|
|
137
|
+
压过内容中的反引号序列),工具的原始输出因此按字面渲染,不会被当作 Markdown
|
|
138
|
+
解析。
|
|
139
|
+
|
|
140
|
+
### Callout 在 Obsidian 之外的渲染
|
|
141
|
+
|
|
142
|
+
Callout 本质是首行带类型标记的引用块(`> [!note] 标题`):认得这个标记的
|
|
143
|
+
渲染器把它画成带标题、配色、可折叠的面板,其余渲染器看到的仍是完全合法的
|
|
144
|
+
引用块。这套语法由 Obsidian 发扬光大,并以折叠标记(`-` 收起、`+` 展开)
|
|
145
|
+
和任意类型加以扩展;GitHub 则把同一标记的五种类型(`[!note]` …
|
|
146
|
+
`[!caution]`,无折叠)标准化为自家的 "alerts"。归档文件在 Obsidian 中渲染
|
|
147
|
+
最佳——自定义类型与预设折叠都在——但会画 callout 面板的远不止 Obsidian
|
|
148
|
+
一家:
|
|
149
|
+
|
|
150
|
+
- **[Quartz](https://quartz.jzhao.xyz)** —— 发布 Obsidian vault 的静态站点
|
|
151
|
+
生成器,渲染同一套 callout 语法,含折叠。
|
|
152
|
+
- **VS Code** —— 内置 markdown 预览装上扩展即可渲染面板,如 Markdown
|
|
153
|
+
Obsidian Callout、vscode-markdown-obsidian-alert、Markdown GitHub
|
|
154
|
+
Alerts & Obsidian Callouts。
|
|
155
|
+
- **静态站点管线** —— remark 插件把 callout 渲染到网页上:
|
|
156
|
+
remark-obsidian-callout(Astro 等)解析完整 Obsidian 语法,
|
|
157
|
+
remark-github-blockquote-alert 对应 GitHub 子集。
|
|
158
|
+
- **标准化子集** —— GitHub 本身、Typora(偏好设置中开启)与 Markdown
|
|
159
|
+
Preview Enhanced 渲染的是 GitHub 的 alert 类型;本插件用到的
|
|
160
|
+
`tldr`/`quote` 类型与折叠标记不在其列,在这些环境里 callout 于是退化为
|
|
161
|
+
普通(依旧可读的)引用块——正是该语法与生俱来的优雅降级。
|
|
136
162
|
|
|
137
163
|
客户端或 agent 注入到用户消息中的提示块——编辑器当前选区、附加或引用的
|
|
138
|
-
笔记、加载的 skill——会从原始 XML(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
`path`/`location`
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
164
|
+
笔记、加载的 skill——会从原始 XML(Markdown 渲染器无法有效呈现,在
|
|
165
|
+
Obsidian 中显示为裸露的尖括号文本)重新渲染为通用 callout。不做任何
|
|
166
|
+
逐块解析:标题取标记名的分词(`editor_selection` → Editor Selection),
|
|
167
|
+
正文以形似 vault 相对笔记路径的 `path`/`location` 值开头——直接渲染为不带
|
|
168
|
+
标签的 wikilink(`[[…|别名]]` 在 Obsidian、Quartz、Markdown Preview
|
|
169
|
+
Enhanced 等环境里都是可点击链接,别名文件名自解释,`path:` 标签反而冗
|
|
170
|
+
余),其余属性以 `**属性**: 值` 跟随,最后是引用内容。所有 callout 一律
|
|
171
|
+
预设折叠——用户提供的块(选区、笔记附件)为 `> [!quote]-`(仅有属性的自闭
|
|
172
|
+
合笔记引用同样折叠),agent 侧痕迹(skill)为 `> [!note]- Skill · <名称>`
|
|
173
|
+
标记(加载的 skill 名称直接进标题,折叠状态也能看到是哪个 skill;location
|
|
174
|
+
跟在正文,内容丢弃);连续的同标签块(中间只有空白)合并进同一个 callout,
|
|
175
|
+
一串笔记引用因此收拢为一份列表(skill 标记不合并:各自标注各自的 skill)。
|
|
176
|
+
未知标记原样保留,用户粘贴的 XML 内容绝不会被误改;回退文件名 slug 也从剥
|
|
177
|
+
离全部已知块后的纯键入文本推导。
|
|
151
178
|
|
|
152
179
|
当前识别的注入块标签清单:
|
|
153
180
|
|
|
@@ -167,7 +194,8 @@ XML 内容绝不会被误改;回退文件名 slug 也从剥离全部已知块
|
|
|
167
194
|
每个消息块以 setext 一级信息头(`User`、`Assistant`,下一行以 `===` 下划)
|
|
168
195
|
开头——高于 AI 内容常见的 `##` 二级标题,解析时也能与内容中的 `#` 一级标题
|
|
169
196
|
区分开。信息头的元数据(本地日期时间,assistant 消息还带模型名)放在一个小号
|
|
170
|
-
浅色 `<span>` 中(`0.5em`,Obsidian 的 `--text-faint`
|
|
197
|
+
浅色 `<span>` 中(`0.5em`,Obsidian 的 `--text-faint` 颜色;无此变量的渲染器
|
|
198
|
+
回退为继承的正文字色),角色名因此保持
|
|
171
199
|
醒目,细节又触手可及。每个消息块以"上下各一个空行"包裹的 `---` 分隔线结尾
|
|
172
200
|
(多余空行会被裁剪),无论是阅读还是程序化切分,都能清楚地区分每个消息块。
|
|
173
201
|
文档标题紧跟在 frontmatter 之后,中间没有空行;追加保存时会顺带修复旧版本
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-auto-save-to-markdown",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Pi extension that automatically saves each completed conversation turn as a markdown file with YAML frontmatter, one file per session-tree branch.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|