Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:memo: Include mind map Spec 5 in format summaries https://github.com/siyuan-note/siyuan/issues/20163

Daniel951b0e333e47
diff --git a/docs/SY-FORMAT.md b/docs/SY-FORMAT.md
index fc1019cf6b..5133cd69c2 100644
--- a/docs/SY-FORMAT.md
+++ b/docs/SY-FORMAT.md
@@ -2,7 +2,7 @@
[中文](SY-FORMAT.zh-CN.md)
-> Canonical Spec baseline: `2` for ordinary documents, `3` for documents containing tabs, `4` for documents using table-cell rich text; compatible readers may upgrade older or missing versions.
+> Canonical Spec baseline: `2` for ordinary documents, `3` for documents containing tabs, `4` for documents using table-cell rich text, `5` for documents containing mind map nodes; compatible readers may upgrade older or missing versions.
> Verified against samples: `20200825162036-4dx365o.sy` (formatting elements), `20200905090211-2vixtlf.sy` (block types).
> All conclusions are based on real samples and the current Lute / SiYuan kernel source. The cited samples contain a few known legacy artifacts; canonical write rules follow the current source when a sample differs.
> This guide describes plaintext `.sy` JSON in an ordinary notebook, or the decrypted AST of an unlocked encrypted notebook. An encrypted notebook's on-disk `.sy` file is ciphertext and must not be edited as JSON.
@@ -71,7 +71,7 @@ Division of labor among the four paths:
| Top-level key | Required | Meaning |
|---|---|---|
| `ID` | ✅ | Document block ID. **Equals the filename without `.sy`** |
-| `Spec` | ✅ | `"2"` for ordinary documents, `"3"` for tabs documents, `"4"` for documents using table-cell rich text; older or missing values are compatible input and may be upgraded |
+| `Spec` | ✅ | `"2"` for ordinary documents, `"3"` for tabs documents, `"4"` for documents using table-cell rich text, `"5"` for documents containing mind map nodes; older or missing values are compatible input and may be upgraded |
| `Type` | ✅ | `"NodeDocument"` |
| `Properties` | ✅ | Document-level IAL — see §8 |
| `Children` | ✅ | Array of body child blocks; canonical files contain at least one block |
@@ -642,7 +642,7 @@ Canonical writers must not generate the following syntax or node families. Most
When generating or compatibly editing a `.sy` that SiYuan can load cleanly, verify item by item:
-1. ☐ Root `Type` = `"NodeDocument"`, `Spec` = `"2"`, `"3"` (tabs), or `"4"` (table-cell rich text), without lowering an existing version; root `ID` = filename (without `.sy`) and equals `Properties.id`
+1. ☐ Root `Type` = `"NodeDocument"`, `Spec` = `"2"`, `"3"` (tabs), `"4"` (table-cell rich text), or `"5"` (mind map nodes), without lowering an existing version; root `ID` = filename (without `.sy`) and equals `Properties.id`
2. ☐ Root `Properties` contains `id`/`title`/`type:"doc"`/`updated`
3. ☐ Every newly generated ID is fresh and workspace-wide unique; every canonical block has a 22-char `ID`, matching `Properties.id`, and a valid 14-digit `Properties.updated`
4. ☐ Determine block status from `Type`, not from `ID`; do not add IDs to new inline/marker nodes, and only remove historical non-block IDs as field normalization without deleting the node
diff --git a/docs/SY-FORMAT.zh-CN.md b/docs/SY-FORMAT.zh-CN.md
index 92f64e03ed..8650bc8ab1 100644
--- a/docs/SY-FORMAT.zh-CN.md
+++ b/docs/SY-FORMAT.zh-CN.md
@@ -2,7 +2,7 @@
[English](SY-FORMAT.md)
-> 规范写入基准:普通文档为 Spec `2`,包含页签的文档为 Spec `3`,使用表格单元格富文本的文档为 Spec `4`;兼容读取器可以升级旧版或缺少 `Spec` 的数据。
+> 规范写入基准:普通文档为 Spec `2`,包含页签的文档为 Spec `3`,使用表格单元格富文本的文档为 Spec `4`,包含思维导图节点的文档为 Spec `5`;兼容读取器可以升级旧版或缺少 `Spec` 的数据。
> 核验样本:`20200825162036-4dx365o.sy`(排版元素)、`20200905090211-2vixtlf.sy`(内容块类型)。
> 本文档所有结论均基于真实样本及当前 Lute / 思源内核源码核验。上述样本包含少量已知的历史遗留数据;样本与当前源码不一致时,规范写入规则以当前源码为准。
> 本指南描述普通笔记本中的明文 `.sy` JSON,或已解锁加密笔记本的解密后 AST。但加密笔记本磁盘上的 `.sy` 文件是密文,不能当作 JSON 直接编辑。
@@ -71,7 +71,7 @@
| 顶层键 | 必有 | 说明 |
|---|---|---|
| `ID` | ✅ | 文档块 ID,**等于去掉 `.sy` 后的文件名** |
-| `Spec` | ✅ | 普通文档为 `"2"`,页签文档为 `"3"`,使用表格单元格富文本的文档为 `"4"`;旧值或缺失值属于兼容输入,可以升级 |
+| `Spec` | ✅ | 普通文档为 `"2"`,页签文档为 `"3"`,使用表格单元格富文本的文档为 `"4"`,包含思维导图节点的文档为 `"5"`;旧值或缺失值属于兼容输入,可以升级 |
| `Type` | ✅ | `"NodeDocument"` |
| `Properties` | ✅ | 文档级 IAL,见 §8 |
| `Children` | ✅ | 正文子块数组;规范文件至少包含一个块 |
@@ -641,7 +641,7 @@ NodeList NodeList
生成或兼容编辑一份能被思源正常加载的 `.sy` 时,应逐条核对:
-1. ☐ 根 `Type` = `"NodeDocument"`、`Spec` = `"2"`、`"3"`(页签)或 `"4"`(表格单元格富文本),且不降低已有版本;根 `ID` 等于去掉 `.sy` 后的文件名,并等于 `Properties.id`
+1. ☐ 根 `Type` = `"NodeDocument"`、`Spec` = `"2"`、`"3"`(页签)、`"4"`(表格单元格富文本)或 `"5"`(思维导图节点),且不降低已有版本;根 `ID` 等于去掉 `.sy` 后的文件名,并等于 `Properties.id`
2. ☐ 根 `Properties` 包含 `id` / `title` / `type:"doc"` / `updated`
3. ☐ 每个新生成的 ID 都是新值且在整个工作区中唯一;每个规范块都有 22 字符 `ID`、与之匹配的 `Properties.id`,以及合法的 14 位 `Properties.updated`
4. ☐ 根据 `Type` 而不是 `ID` 判断块;不要为新内联或标记节点添加 ID,只能将历史非块 ID 作为字段规范化清理,不能删除节点本身