json-canvas
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseJSON Canvas Skill
JSON Canvas 技能
This skill enables skills-compatible agents to create and edit valid JSON Canvas files () used in Obsidian and other applications.
.canvas本技能支持兼容技能的Agent创建和编辑Obsidian及其他应用中使用的有效JSON Canvas文件()。
.canvasOverview
概述
JSON Canvas is an open file format for infinite canvas data. Canvas files use the extension and contain valid JSON following the JSON Canvas Spec 1.0.
.canvasJSON Canvas是一种用于无限画布数据的开放文件格式。Canvas文件使用扩展名,遵循JSON Canvas Spec 1.0的规范,包含有效的JSON内容。
.canvasFile Structure
文件结构
A canvas file contains two top-level arrays:
json
{
"nodes": [],
"edges": []
}- (optional): Array of node objects
nodes - (optional): Array of edge objects connecting nodes
edges
一个canvas文件包含两个顶层数组:
json
{
"nodes": [],
"edges": []
}- (可选):节点对象数组
nodes - (可选):连接节点的边对象数组
edges
Nodes
节点
Nodes are objects placed on the canvas. There are four node types:
- - Text content with Markdown
text - - Reference to files/attachments
file - - External URL
link - - Visual container for other nodes
group
节点是放置在画布上的对象。共有四种节点类型:
- - 包含Markdown格式的文本内容
text - - 指向文件/附件的引用
file - - 外部URL链接
link - - 用于组织其他节点的可视化容器
group
Z-Index Ordering
Z轴层级排序
Nodes are ordered by z-index in the array:
- First node = bottom layer (displayed below others)
- Last node = top layer (displayed above others)
节点在数组中的顺序决定了Z轴层级:
- 数组中的第一个节点位于最底层(显示在其他节点下方)
- 数组中的最后一个节点位于最顶层(显示在其他节点上方)
Generic Node Attributes
通用节点属性
All nodes share these attributes:
| Attribute | Required | Type | Description |
|---|---|---|---|
| Yes | string | Unique identifier for the node |
| Yes | string | Node type: |
| Yes | integer | X position in pixels |
| Yes | integer | Y position in pixels |
| Yes | integer | Width in pixels |
| Yes | integer | Height in pixels |
| No | canvasColor | Node color (see Color section) |
所有节点都具备以下属性:
| 属性 | 是否必填 | 类型 | 描述 |
|---|---|---|---|
| 是 | string | 节点的唯一标识符 |
| 是 | string | 节点类型: |
| 是 | integer | 节点在画布上的X坐标(像素) |
| 是 | integer | 节点在画布上的Y坐标(像素) |
| 是 | integer | 节点宽度(像素) |
| 是 | integer | 节点高度(像素) |
| 否 | canvasColor | 节点颜色(参考颜色章节) |
Text Nodes
文本节点
Text nodes contain Markdown content.
json
{
"id": "6f0ad84f44ce9c17",
"type": "text",
"x": 0,
"y": 0,
"width": 400,
"height": 200,
"text": "# Hello World\n\nThis is **Markdown** content."
}文本节点包含Markdown格式的内容。
json
{
"id": "6f0ad84f44ce9c17",
"type": "text",
"x": 0,
"y": 0,
"width": 400,
"height": 200,
"text": "# Hello World\n\nThis is **Markdown** content."
}Newline Escaping (Common Pitfall)
换行符转义(常见误区)
In JSON, newline characters inside strings must be represented as . Do not use the literal sequence in a file—Obsidian will render it as the characters and instead of a line break.
\n\\n.canvas\nExamples:
json
{ "type": "text", "text": "Line 1\nLine 2" }json
{ "type": "text", "text": "Line 1\\nLine 2" }| Attribute | Required | Type | Description |
|---|---|---|---|
| Yes | string | Plain text with Markdown syntax |
在JSON中,字符串内的换行符必须用表示。请勿在.canvas文件中使用字面量——Obsidian会将其渲染为字符和,而非换行符。
\n\\n\n示例:
json
{ "type": "text", "text": "Line 1\nLine 2" }json
{ "type": "text", "text": "Line 1\\nLine 2" }| 属性 | 是否必填 | 类型 | 描述 |
|---|---|---|---|
| 是 | string | 包含Markdown语法的纯文本 |
File Nodes
文件节点
File nodes reference files or attachments (images, videos, PDFs, notes, etc.).
json
{
"id": "a1b2c3d4e5f67890",
"type": "file",
"x": 500,
"y": 0,
"width": 400,
"height": 300,
"file": "Attachments/diagram.png"
}json
{
"id": "b2c3d4e5f6789012",
"type": "file",
"x": 500,
"y": 400,
"width": 400,
"height": 300,
"file": "Notes/Project Overview.md",
"subpath": "#Implementation"
}| Attribute | Required | Type | Description |
|---|---|---|---|
| Yes | string | Path to file within the system |
| No | string | Link to heading or block (starts with |
文件节点指向文件或附件(图片、视频、PDF、笔记等)。
json
{
"id": "a1b2c3d4e5f67890",
"type": "file",
"x": 500,
"y": 0,
"width": 400,
"height": 300,
"file": "Attachments/diagram.png"
}json
{
"id": "b2c3d4e5f6789012",
"type": "file",
"x": 500,
"y": 400,
"width": 400,
"height": 300,
"file": "Notes/Project Overview.md",
"subpath": "#Implementation"
}| 属性 | 是否必填 | 类型 | 描述 |
|---|---|---|---|
| 是 | string | 系统内的文件路径 |
| 否 | string | 指向标题或块的链接(以 |
Link Nodes
链接节点
Link nodes display external URLs.
json
{
"id": "c3d4e5f678901234",
"type": "link",
"x": 1000,
"y": 0,
"width": 400,
"height": 200,
"url": "https://obsidian.md"
}| Attribute | Required | Type | Description |
|---|---|---|---|
| Yes | string | External URL |
链接节点显示外部URL。
json
{
"id": "c3d4e5f678901234",
"type": "link",
"x": 1000,
"y": 0,
"width": 400,
"height": 200,
"url": "https://obsidian.md"
}| 属性 | 是否必填 | 类型 | 描述 |
|---|---|---|---|
| 是 | string | 外部URL地址 |
Group Nodes
组节点
Group nodes are visual containers for organizing other nodes.
json
{
"id": "d4e5f6789012345a",
"type": "group",
"x": -50,
"y": -50,
"width": 1000,
"height": 600,
"label": "Project Overview",
"color": "4"
}json
{
"id": "e5f67890123456ab",
"type": "group",
"x": 0,
"y": 700,
"width": 800,
"height": 500,
"label": "Resources",
"background": "Attachments/background.png",
"backgroundStyle": "cover"
}| Attribute | Required | Type | Description |
|---|---|---|---|
| No | string | Text label for the group |
| No | string | Path to background image |
| No | string | Background rendering style |
组节点是用于组织其他节点的可视化容器。
json
{
"id": "d4e5f6789012345a",
"type": "group",
"x": -50,
"y": -50,
"width": 1000,
"height": 600,
"label": "Project Overview",
"color": "4"
}json
{
"id": "e5f67890123456ab",
"type": "group",
"x": 0,
"y": 700,
"width": 800,
"height": 500,
"label": "Resources",
"background": "Attachments/background.png",
"backgroundStyle": "cover"
}| 属性 | 是否必填 | 类型 | 描述 |
|---|---|---|---|
| 否 | string | 组的文本标签 |
| 否 | string | 背景图片的路径 |
| 否 | string | 背景图片的渲染样式 |
Background Styles
背景样式
| Value | Description |
|---|---|
| Fills entire width and height of node |
| Maintains aspect ratio of background image |
| Repeats image as pattern in both directions |
| 值 | 描述 |
|---|---|
| 填充节点的整个宽高 |
| 保持背景图片的宽高比 |
| 在水平和垂直方向重复图片作为图案 |
Edges
边
Edges are lines connecting nodes.
json
{
"id": "f67890123456789a",
"fromNode": "6f0ad84f44ce9c17",
"toNode": "a1b2c3d4e5f67890"
}json
{
"id": "0123456789abcdef",
"fromNode": "6f0ad84f44ce9c17",
"fromSide": "right",
"fromEnd": "none",
"toNode": "b2c3d4e5f6789012",
"toSide": "left",
"toEnd": "arrow",
"color": "1",
"label": "leads to"
}| Attribute | Required | Type | Default | Description |
|---|---|---|---|---|
| Yes | string | - | Unique identifier for the edge |
| Yes | string | - | Node ID where connection starts |
| No | string | - | Side where edge starts |
| No | string | | Shape at edge start |
| Yes | string | - | Node ID where connection ends |
| No | string | - | Side where edge ends |
| No | string | | Shape at edge end |
| No | canvasColor | - | Line color |
| No | string | - | Text label for the edge |
边是连接节点的线条。
json
{
"id": "f67890123456789a",
"fromNode": "6f0ad84f44ce9c17",
"toNode": "a1b2c3d4e5f67890"
}json
{
"id": "0123456789abcdef",
"fromNode": "6f0ad84f44ce9c17",
"fromSide": "right",
"fromEnd": "none",
"toNode": "b2c3d4e5f6789012",
"toSide": "left",
"toEnd": "arrow",
"color": "1",
"label": "leads to"
}| 属性 | 是否必填 | 类型 | 默认值 | 描述 |
|---|---|---|---|---|
| 是 | string | - | 边的唯一标识符 |
| 是 | string | - | 连接起始节点的ID |
| 否 | string | - | 边的起始侧 |
| 否 | string | | 边起始端的形状 |
| 是 | string | - | 连接目标节点的ID |
| 否 | string | - | 边的目标侧 |
| 否 | string | | 边目标端的形状 |
| 否 | canvasColor | - | 线条颜色 |
| 否 | string | - | 边的文本标签 |
Side Values
侧边取值
| Value | Description |
|---|---|
| Top edge of node |
| Right edge of node |
| Bottom edge of node |
| Left edge of node |
| 值 | 描述 |
|---|---|
| 节点的顶部边缘 |
| 节点的右侧边缘 |
| 节点的底部边缘 |
| 节点的左侧边缘 |
End Shapes
端点形状
| Value | Description |
|---|---|
| No endpoint shape |
| Arrow endpoint |
| 值 | 描述 |
|---|---|
| 无端点形状 |
| 箭头端点 |
Colors
颜色
The type can be specified in two ways:
canvasColorcanvasColorHex Colors
十六进制颜色
json
{
"color": "#FF0000"
}json
{
"color": "#FF0000"
}Preset Colors
预设颜色
json
{
"color": "1"
}| Preset | Color |
|---|---|
| Red |
| Orange |
| Yellow |
| Green |
| Cyan |
| Purple |
Note: Specific color values for presets are intentionally undefined, allowing applications to use their own brand colors.
json
{
"color": "1"
}| 预设值 | 颜色 |
|---|---|
| 红色 |
| 橙色 |
| 黄色 |
| 绿色 |
| 青色 |
| 紫色 |
注意:预设颜色的具体取值并未明确定义,允许应用程序使用自身的品牌颜色。
Complete Examples
完整示例
Simple Canvas with Text and Connections
包含文本和连接的简单画布
json
{
"nodes": [
{
"id": "8a9b0c1d2e3f4a5b",
"type": "text",
"x": 0,
"y": 0,
"width": 300,
"height": 150,
"text": "# Main Idea\n\nThis is the central concept."
},
{
"id": "1a2b3c4d5e6f7a8b",
"type": "text",
"x": 400,
"y": -100,
"width": 250,
"height": 100,
"text": "## Supporting Point A\n\nDetails here."
},
{
"id": "2b3c4d5e6f7a8b9c",
"type": "text",
"x": 400,
"y": 100,
"width": 250,
"height": 100,
"text": "## Supporting Point B\n\nMore details."
}
],
"edges": [
{
"id": "3c4d5e6f7a8b9c0d",
"fromNode": "8a9b0c1d2e3f4a5b",
"fromSide": "right",
"toNode": "1a2b3c4d5e6f7a8b",
"toSide": "left"
},
{
"id": "4d5e6f7a8b9c0d1e",
"fromNode": "8a9b0c1d2e3f4a5b",
"fromSide": "right",
"toNode": "2b3c4d5e6f7a8b9c",
"toSide": "left"
}
]
}json
{
"nodes": [
{
"id": "8a9b0c1d2e3f4a5b",
"type": "text",
"x": 0,
"y": 0,
"width": 300,
"height": 150,
"text": "# Main Idea\n\nThis is the central concept."
},
{
"id": "1a2b3c4d5e6f7a8b",
"type": "text",
"x": 400,
"y": -100,
"width": 250,
"height": 100,
"text": "## Supporting Point A\n\nDetails here."
},
{
"id": "2b3c4d5e6f7a8b9c",
"type": "text",
"x": 400,
"y": 100,
"width": 250,
"height": 100,
"text": "## Supporting Point B\n\nMore details."
}
],
"edges": [
{
"id": "3c4d5e6f7a8b9c0d",
"fromNode": "8a9b0c1d2e3f4a5b",
"fromSide": "right",
"toNode": "1a2b3c4d5e6f7a8b",
"toSide": "left"
},
{
"id": "4d5e6f7a8b9c0d1e",
"fromNode": "8a9b0c1d2e3f4a5b",
"fromSide": "right",
"toNode": "2b3c4d5e6f7a8b9c",
"toSide": "left"
}
]
}Project Board with Groups
包含组的项目看板
json
{
"nodes": [
{
"id": "5e6f7a8b9c0d1e2f",
"type": "group",
"x": 0,
"y": 0,
"width": 300,
"height": 500,
"label": "To Do",
"color": "1"
},
{
"id": "6f7a8b9c0d1e2f3a",
"type": "group",
"x": 350,
"y": 0,
"width": 300,
"height": 500,
"label": "In Progress",
"color": "3"
},
{
"id": "7a8b9c0d1e2f3a4b",
"type": "group",
"x": 700,
"y": 0,
"width": 300,
"height": 500,
"label": "Done",
"color": "4"
},
{
"id": "8b9c0d1e2f3a4b5c",
"type": "text",
"x": 20,
"y": 50,
"width": 260,
"height": 80,
"text": "## Task 1\n\nImplement feature X"
},
{
"id": "9c0d1e2f3a4b5c6d",
"type": "text",
"x": 370,
"y": 50,
"width": 260,
"height": 80,
"text": "## Task 2\n\nReview PR #123",
"color": "2"
},
{
"id": "0d1e2f3a4b5c6d7e",
"type": "text",
"x": 720,
"y": 50,
"width": 260,
"height": 80,
"text": "## Task 3\n\n~~Setup CI/CD~~"
}
],
"edges": []
}json
{
"nodes": [
{
"id": "5e6f7a8b9c0d1e2f",
"type": "group",
"x": 0,
"y": 0,
"width": 300,
"height": 500,
"label": "To Do",
"color": "1"
},
{
"id": "6f7a8b9c0d1e2f3a",
"type": "group",
"x": 350,
"y": 0,
"width": 300,
"height": 500,
"label": "In Progress",
"color": "3"
},
{
"id": "7a8b9c0d1e2f3a4b",
"type": "group",
"x": 700,
"y": 0,
"width": 300,
"height": 500,
"label": "Done",
"color": "4"
},
{
"id": "8b9c0d1e2f3a4b5c",
"type": "text",
"x": 20,
"y": 50,
"width": 260,
"height": 80,
"text": "## Task 1\n\nImplement feature X"
},
{
"id": "9c0d1e2f3a4b5c6d",
"type": "text",
"x": 370,
"y": 50,
"width": 260,
"height": 80,
"text": "## Task 2\n\nReview PR #123",
"color": "2"
},
{
"id": "0d1e2f3a4b5c6d7e",
"type": "text",
"x": 720,
"y": 50,
"width": 260,
"height": 80,
"text": "## Task 3\n\n~~Setup CI/CD~~"
}
],
"edges": []
}Research Canvas with Files and Links
包含文件和链接的研究画布
json
{
"nodes": [
{
"id": "1e2f3a4b5c6d7e8f",
"type": "text",
"x": 300,
"y": 200,
"width": 400,
"height": 200,
"text": "# Research Topic\n\n## Key Questions\n\n- How does X affect Y?\n- What are the implications?",
"color": "5"
},
{
"id": "2f3a4b5c6d7e8f9a",
"type": "file",
"x": 0,
"y": 0,
"width": 250,
"height": 150,
"file": "Literature/Paper A.pdf"
},
{
"id": "3a4b5c6d7e8f9a0b",
"type": "file",
"x": 0,
"y": 200,
"width": 250,
"height": 150,
"file": "Notes/Meeting Notes.md",
"subpath": "#Key Insights"
},
{
"id": "4b5c6d7e8f9a0b1c",
"type": "link",
"x": 0,
"y": 400,
"width": 250,
"height": 100,
"url": "https://example.com/research"
},
{
"id": "5c6d7e8f9a0b1c2d",
"type": "file",
"x": 750,
"y": 150,
"width": 300,
"height": 250,
"file": "Attachments/diagram.png"
}
],
"edges": [
{
"id": "6d7e8f9a0b1c2d3e",
"fromNode": "2f3a4b5c6d7e8f9a",
"fromSide": "right",
"toNode": "1e2f3a4b5c6d7e8f",
"toSide": "left",
"label": "supports"
},
{
"id": "7e8f9a0b1c2d3e4f",
"fromNode": "3a4b5c6d7e8f9a0b",
"fromSide": "right",
"toNode": "1e2f3a4b5c6d7e8f",
"toSide": "left",
"label": "informs"
},
{
"id": "8f9a0b1c2d3e4f5a",
"fromNode": "4b5c6d7e8f9a0b1c",
"fromSide": "right",
"toNode": "1e2f3a4b5c6d7e8f",
"toSide": "left",
"toEnd": "arrow",
"color": "6"
},
{
"id": "9a0b1c2d3e4f5a6b",
"fromNode": "1e2f3a4b5c6d7e8f",
"fromSide": "right",
"toNode": "5c6d7e8f9a0b1c2d",
"toSide": "left",
"label": "visualized by"
}
]
}json
{
"nodes": [
{
"id": "1e2f3a4b5c6d7e8f",
"type": "text",
"x": 300,
"y": 200,
"width": 400,
"height": 200,
"text": "# Research Topic\n\n## Key Questions\n\n- How does X affect Y?\n- What are the implications?",
"color": "5"
},
{
"id": "2f3a4b5c6d7e8f9a",
"type": "file",
"x": 0,
"y": 0,
"width": 250,
"height": 150,
"file": "Literature/Paper A.pdf"
},
{
"id": "3a4b5c6d7e8f9a0b",
"type": "file",
"x": 0,
"y": 200,
"width": 250,
"height": 150,
"file": "Notes/Meeting Notes.md",
"subpath": "#Key Insights"
},
{
"id": "4b5c6d7e8f9a0b1c",
"type": "link",
"x": 0,
"y": 400,
"width": 250,
"height": 100,
"url": "https://example.com/research"
},
{
"id": "5c6d7e8f9a0b1c2d",
"type": "file",
"x": 750,
"y": 150,
"width": 300,
"height": 250,
"file": "Attachments/diagram.png"
}
],
"edges": [
{
"id": "6d7e8f9a0b1c2d3e",
"fromNode": "2f3a4b5c6d7e8f9a",
"fromSide": "right",
"toNode": "1e2f3a4b5c6d7e8f",
"toSide": "left",
"label": "supports"
},
{
"id": "7e8f9a0b1c2d3e4f",
"fromNode": "3a4b5c6d7e8f9a0b",
"fromSide": "right",
"toNode": "1e2f3a4b5c6d7e8f",
"toSide": "left",
"label": "informs"
},
{
"id": "8f9a0b1c2d3e4f5a",
"fromNode": "4b5c6d7e8f9a0b1c",
"fromSide": "right",
"toNode": "1e2f3a4b5c6d7e8f",
"toSide": "left",
"toEnd": "arrow",
"color": "6"
},
{
"id": "9a0b1c2d3e4f5a6b",
"fromNode": "1e2f3a4b5c6d7e8f",
"fromSide": "right",
"toNode": "5c6d7e8f9a0b1c2d",
"toSide": "left",
"label": "visualized by"
}
]
}Flowchart
流程图
json
{
"nodes": [
{
"id": "a0b1c2d3e4f5a6b7",
"type": "text",
"x": 200,
"y": 0,
"width": 150,
"height": 60,
"text": "**Start**",
"color": "4"
},
{
"id": "b1c2d3e4f5a6b7c8",
"type": "text",
"x": 200,
"y": 100,
"width": 150,
"height": 60,
"text": "Step 1:\nGather data"
},
{
"id": "c2d3e4f5a6b7c8d9",
"type": "text",
"x": 200,
"y": 200,
"width": 150,
"height": 80,
"text": "**Decision**\n\nIs data valid?",
"color": "3"
},
{
"id": "d3e4f5a6b7c8d9e0",
"type": "text",
"x": 400,
"y": 200,
"width": 150,
"height": 60,
"text": "Process data"
},
{
"id": "e4f5a6b7c8d9e0f1",
"type": "text",
"x": 0,
"y": 200,
"width": 150,
"height": 60,
"text": "Request new data",
"color": "1"
},
{
"id": "f5a6b7c8d9e0f1a2",
"type": "text",
"x": 400,
"y": 320,
"width": 150,
"height": 60,
"text": "**End**",
"color": "4"
}
],
"edges": [
{
"id": "a6b7c8d9e0f1a2b3",
"fromNode": "a0b1c2d3e4f5a6b7",
"fromSide": "bottom",
"toNode": "b1c2d3e4f5a6b7c8",
"toSide": "top"
},
{
"id": "b7c8d9e0f1a2b3c4",
"fromNode": "b1c2d3e4f5a6b7c8",
"fromSide": "bottom",
"toNode": "c2d3e4f5a6b7c8d9",
"toSide": "top"
},
{
"id": "c8d9e0f1a2b3c4d5",
"fromNode": "c2d3e4f5a6b7c8d9",
"fromSide": "right",
"toNode": "d3e4f5a6b7c8d9e0",
"toSide": "left",
"label": "Yes",
"color": "4"
},
{
"id": "d9e0f1a2b3c4d5e6",
"fromNode": "c2d3e4f5a6b7c8d9",
"fromSide": "left",
"toNode": "e4f5a6b7c8d9e0f1",
"toSide": "right",
"label": "No",
"color": "1"
},
{
"id": "e0f1a2b3c4d5e6f7",
"fromNode": "e4f5a6b7c8d9e0f1",
"fromSide": "top",
"fromEnd": "none",
"toNode": "b1c2d3e4f5a6b7c8",
"toSide": "left",
"toEnd": "arrow"
},
{
"id": "f1a2b3c4d5e6f7a8",
"fromNode": "d3e4f5a6b7c8d9e0",
"fromSide": "bottom",
"toNode": "f5a6b7c8d9e0f1a2",
"toSide": "top"
}
]
}json
{
"nodes": [
{
"id": "a0b1c2d3e4f5a6b7",
"type": "text",
"x": 200,
"y": 0,
"width": 150,
"height": 60,
"text": "**Start**",
"color": "4"
},
{
"id": "b1c2d3e4f5a6b7c8",
"type": "text",
"x": 200,
"y": 100,
"width": 150,
"height": 60,
"text": "Step 1:\nGather data"
},
{
"id": "c2d3e4f5a6b7c8d9",
"type": "text",
"x": 200,
"y": 200,
"width": 150,
"height": 80,
"text": "**Decision**\n\nIs data valid?",
"color": "3"
},
{
"id": "d3e4f5a6b7c8d9e0",
"type": "text",
"x": 400,
"y": 200,
"width": 150,
"height": 60,
"text": "Process data"
},
{
"id": "e4f5a6b7c8d9e0f1",
"type": "text",
"x": 0,
"y": 200,
"width": 150,
"height": 60,
"text": "Request new data",
"color": "1"
},
{
"id": "f5a6b7c8d9e0f1a2",
"type": "text",
"x": 400,
"y": 320,
"width": 150,
"height": 60,
"text": "**End**",
"color": "4"
}
],
"edges": [
{
"id": "a6b7c8d9e0f1a2b3",
"fromNode": "a0b1c2d3e4f5a6b7",
"fromSide": "bottom",
"toNode": "b1c2d3e4f5a6b7c8",
"toSide": "top"
},
{
"id": "b7c8d9e0f1a2b3c4",
"fromNode": "b1c2d3e4f5a6b7c8",
"fromSide": "bottom",
"toNode": "c2d3e4f5a6b7c8d9",
"toSide": "top"
},
{
"id": "c8d9e0f1a2b3c4d5",
"fromNode": "c2d3e4f5a6b7c8d9",
"fromSide": "right",
"toNode": "d3e4f5a6b7c8d9e0",
"toSide": "left",
"label": "Yes",
"color": "4"
},
{
"id": "d9e0f1a2b3c4d5e6",
"fromNode": "c2d3e4f5a6b7c8d9",
"fromSide": "left",
"toNode": "e4f5a6b7c8d9e0f1",
"toSide": "right",
"label": "No",
"color": "1"
},
{
"id": "e0f1a2b3c4d5e6f7",
"fromNode": "e4f5a6b7c8d9e0f1",
"fromSide": "top",
"fromEnd": "none",
"toNode": "b1c2d3e4f5a6b7c8",
"toSide": "left",
"toEnd": "arrow"
},
{
"id": "f1a2b3c4d5e6f7a8",
"fromNode": "d3e4f5a6b7c8d9e0",
"fromSide": "bottom",
"toNode": "f5a6b7c8d9e0f1a2",
"toSide": "top"
}
]
}ID Generation
ID生成
Node and edge IDs must be unique strings. Obsidian generates 16-character hexadecimal IDs:
json
"id": "6f0ad84f44ce9c17"
"id": "a3b2c1d0e9f8g7h6"
"id": "1234567890abcdef"This format is a 16-character lowercase hex string (64-bit random value).
节点和边的ID必须是唯一的字符串。Obsidian会生成16位的十六进制ID:
json
"id": "6f0ad84f44ce9c17"
"id": "a3b2c1d0e9f8g7h6"
"id": "1234567890abcdef"这种格式是16位的小写十六进制字符串(64位随机值)。
Layout Guidelines
布局指南
Positioning
定位
- Coordinates can be negative (canvas extends infinitely)
- increases to the right
x - increases downward
y - Position refers to top-left corner of node
- 坐标可以为负数(画布是无限延伸的)
- 值越大,节点越靠右
x - 值越大,节点越靠下
y - 坐标指的是节点的左上角位置
Recommended Sizes
推荐尺寸
| Node Type | Suggested Width | Suggested Height |
|---|---|---|
| Small text | 200-300 | 80-150 |
| Medium text | 300-450 | 150-300 |
| Large text | 400-600 | 300-500 |
| File preview | 300-500 | 200-400 |
| Link preview | 250-400 | 100-200 |
| Group | Varies | Varies |
| 节点类型 | 推荐宽度 | 推荐高度 |
|---|---|---|
| 小型文本 | 200-300 | 80-150 |
| 中型文本 | 300-450 | 150-300 |
| 大型文本 | 400-600 | 300-500 |
| 文件预览 | 300-500 | 200-400 |
| 链接预览 | 250-400 | 100-200 |
| 组 | 按需调整 | 按需调整 |
Spacing
间距
- Leave 20-50px padding inside groups
- Space nodes 50-100px apart for readability
- Align nodes to grid (multiples of 10 or 20) for cleaner layouts
- 组内节点保留20-50px的内边距
- 节点之间保留50-100px的间距以保证可读性
- 将节点对齐到网格(坐标为10或20的倍数)以获得更整洁的布局
Validation Rules
验证规则
- All values must be unique across nodes and edges
id - and
fromNodemust reference existing node IDstoNode - Required fields must be present for each node type
- must be one of:
type,text,file,linkgroup - must be one of:
backgroundStyle,cover,ratiorepeat - ,
fromSidemust be one of:toSide,top,right,bottomleft - ,
fromEndmust be one of:toEnd,nonearrow - Color presets must be through
"1"or valid hex color"6"
- 所有值在节点和边中必须唯一
id - 和
fromNode必须指向已存在的节点IDtoNode - 每种节点类型必须包含必填字段
- 必须是以下值之一:
type、text、file、linkgroup - 必须是以下值之一:
backgroundStyle、cover、ratiorepeat - 、
fromSide必须是以下值之一:toSide、top、right、bottomleft - 、
fromEnd必须是以下值之一:toEnd、nonearrow - 颜色预设值必须是到
"1"或有效的十六进制颜色"6"