JSON画布
原名:json-canvas
创建和编辑 JSON Canvas 文件(.canvas),支持节点、边、分组和连接。处理 .canvas 文件、可视化画布、思维导图、流程图或 Obsidian 中的 Canvas 文件时使用。
- 分类
- 内容创作
- 版本
- v1.0.0
- 作者
- 弈韬(@ra1nzzz)
- 下载
- 3
- 收藏
- 0
- 发布
- 2026-08-17
- 更新
- 2026-08-18
- TRACE 评分
- 3 / 5
内容概览
A canvas file (.canvas) contains two top-level arrays following the JSON Canvas Spec 1.0: - nodes (optional): Array of node objects - edges (optional): Array of edge objects connecting nodes 1. Create a .canvas file with the base structure {"nodes": [], "edges": []} 2. Generate unique 16-character hex IDs for each node (e.g., "6f0ad84f44ce9c17") 3. Add nodes with required fields: id, type, x, y, width, height 4. Add edges referencing valid node IDs via fromNode and toNode 5. Validate : Parse the JSON to confirm it is valid. Verify all fromNode/toNode values exist in the nodes array 1. Read and parse the existing .canvas file 2. Generate a unique ID that does not collide with existing node or edge IDs 3. Choose position (x, y) that avoids overlapping existing nodes (leave 50-100px spacing) 4. Append the new node object to the nodes array 5. Optionally add edges connecting the new node to …