$npx -y skills add freestylefly/canghe-skills --skill json-canvasCreate and edit JSON Canvas files (.canvas) with nodes, edges, groups, and connections. Use when working with .canvas files, creating visual canvases, mind maps, flowcharts, or when the user mentions Canvas files in Obsidian.
| 1 | # JSON Canvas Skill |
| 2 | |
| 3 | This skill enables skills-compatible agents to create and edit valid JSON Canvas files (`.canvas`) used in Obsidian and other applications. |
| 4 | |
| 5 | ## Overview |
| 6 | |
| 7 | JSON Canvas is an open file format for infinite canvas data. Canvas files use the `.canvas` extension and contain valid JSON following the [JSON Canvas Spec 1.0](https://jsoncanvas.org/spec/1.0/). |
| 8 | |
| 9 | ## File Structure |
| 10 | |
| 11 | A canvas file contains two top-level arrays: |
| 12 | |
| 13 | ```json |
| 14 | { |
| 15 | "nodes": [], |
| 16 | "edges": [] |
| 17 | } |
| 18 | ``` |
| 19 | |
| 20 | - `nodes` (optional): Array of node objects |
| 21 | - `edges` (optional): Array of edge objects connecting nodes |
| 22 | |
| 23 | ## Nodes |
| 24 | |
| 25 | Nodes are objects placed on the canvas. There are four node types: |
| 26 | - `text` - Text content with Markdown |
| 27 | - `file` - Reference to files/attachments |
| 28 | - `link` - External URL |
| 29 | - `group` - Visual container for other nodes |
| 30 | |
| 31 | ### Z-Index Ordering |
| 32 | |
| 33 | Nodes are ordered by z-index in the array: |
| 34 | - First node = bottom layer (displayed below others) |
| 35 | - Last node = top layer (displayed above others) |
| 36 | |
| 37 | ### Generic Node Attributes |
| 38 | |
| 39 | All nodes share these attributes: |
| 40 | |
| 41 | | Attribute | Required | Type | Description | |
| 42 | |-----------|----------|------|-------------| |
| 43 | | `id` | Yes | string | Unique identifier for the node | |
| 44 | | `type` | Yes | string | Node type: `text`, `file`, `link`, or `group` | |
| 45 | | `x` | Yes | integer | X position in pixels | |
| 46 | | `y` | Yes | integer | Y position in pixels | |
| 47 | | `width` | Yes | integer | Width in pixels | |
| 48 | | `height` | Yes | integer | Height in pixels | |
| 49 | | `color` | No | canvasColor | Node color (see Color section) | |
| 50 | |
| 51 | ### Text Nodes |
| 52 | |
| 53 | Text nodes contain Markdown content. |
| 54 | |
| 55 | ```json |
| 56 | { |
| 57 | "id": "6f0ad84f44ce9c17", |
| 58 | "type": "text", |
| 59 | "x": 0, |
| 60 | "y": 0, |
| 61 | "width": 400, |
| 62 | "height": 200, |
| 63 | "text": "# Hello World\n\nThis is **Markdown** content." |
| 64 | } |
| 65 | ``` |
| 66 | |
| 67 | | Attribute | Required | Type | Description | |
| 68 | |-----------|----------|------|-------------| |
| 69 | | `text` | Yes | string | Plain text with Markdown syntax | |
| 70 | |
| 71 | ### File Nodes |
| 72 | |
| 73 | File nodes reference files or attachments (images, videos, PDFs, notes, etc.). |
| 74 | |
| 75 | ```json |
| 76 | { |
| 77 | "id": "a1b2c3d4e5f67890", |
| 78 | "type": "file", |
| 79 | "x": 500, |
| 80 | "y": 0, |
| 81 | "width": 400, |
| 82 | "height": 300, |
| 83 | "file": "Attachments/diagram.png" |
| 84 | } |
| 85 | ``` |
| 86 | |
| 87 | ```json |
| 88 | { |
| 89 | "id": "b2c3d4e5f6789012", |
| 90 | "type": "file", |
| 91 | "x": 500, |
| 92 | "y": 400, |
| 93 | "width": 400, |
| 94 | "height": 300, |
| 95 | "file": "Notes/Project Overview.md", |
| 96 | "subpath": "#Implementation" |
| 97 | } |
| 98 | ``` |
| 99 | |
| 100 | | Attribute | Required | Type | Description | |
| 101 | |-----------|----------|------|-------------| |
| 102 | | `file` | Yes | string | Path to file within the system | |
| 103 | | `subpath` | No | string | Link to heading or block (starts with `#`) | |
| 104 | |
| 105 | ### Link Nodes |
| 106 | |
| 107 | Link nodes display external URLs. |
| 108 | |
| 109 | ```json |
| 110 | { |
| 111 | "id": "c3d4e5f678901234", |
| 112 | "type": "link", |
| 113 | "x": 1000, |
| 114 | "y": 0, |
| 115 | "width": 400, |
| 116 | "height": 200, |
| 117 | "url": "https://obsidian.md" |
| 118 | } |
| 119 | ``` |
| 120 | |
| 121 | | Attribute | Required | Type | Description | |
| 122 | |-----------|----------|------|-------------| |
| 123 | | `url` | Yes | string | External URL | |
| 124 | |
| 125 | ### Group Nodes |
| 126 | |
| 127 | Group nodes are visual containers for organizing other nodes. |
| 128 | |
| 129 | ```json |
| 130 | { |
| 131 | "id": "d4e5f6789012345a", |
| 132 | "type": "group", |
| 133 | "x": -50, |
| 134 | "y": -50, |
| 135 | "width": 1000, |
| 136 | "height": 600, |
| 137 | "label": "Project Overview", |
| 138 | "color": "4" |
| 139 | } |
| 140 | ``` |
| 141 | |
| 142 | ```json |
| 143 | { |
| 144 | "id": "e5f67890123456ab", |
| 145 | "type": "group", |
| 146 | "x": 0, |
| 147 | "y": 700, |
| 148 | "width": 800, |
| 149 | "height": 500, |
| 150 | "label": "Resources", |
| 151 | "background": "Attachments/background.png", |
| 152 | "backgroundStyle": "cover" |
| 153 | } |
| 154 | ``` |
| 155 | |
| 156 | | Attribute | Required | Type | Description | |
| 157 | |-----------|----------|------|-------------| |
| 158 | | `label` | No | string | Text label for the group | |
| 159 | | `background` | No | string | Path to background image | |
| 160 | | `backgroundStyle` | No | string | Background rendering style | |
| 161 | |
| 162 | #### Background Styles |
| 163 | |
| 164 | | Value | Description | |
| 165 | |-------|-------------| |
| 166 | | `cover` | Fills entire width and height of node | |
| 167 | | `ratio` | Maintains aspect ratio of background image | |
| 168 | | `repeat` | Repeats image as pattern in both directions | |
| 169 | |
| 170 | ## Edges |
| 171 | |
| 172 | Edges are lines connecting nodes. |
| 173 | |
| 174 | ```json |
| 175 | { |
| 176 | "id": "f67890123456789a", |
| 177 | "fromNode": "6f0ad84f44ce9c17", |
| 178 | "toNode": "a1b2c3d4e5f67890" |
| 179 | } |
| 180 | ``` |
| 181 | |
| 182 | ```json |
| 183 | { |
| 184 | "id": "0123456789abcdef", |
| 185 | "fromNode": "6f0ad84f44ce9c17", |
| 186 | "fromSide": "right", |
| 187 | "fromEnd": "none", |
| 188 | "toNode": "b2c3d4e5f6789012", |
| 189 | "toSide": "left", |
| 190 | "toEnd": "arrow", |
| 191 | "color": "1", |
| 192 | "label": "leads to" |
| 193 | } |
| 194 | ``` |
| 195 | |
| 196 | | Attribute | Required | Type | Default | Description | |
| 197 | |-----------|----------|------|---------|-------------| |
| 198 | | `id` | Yes | string | - | Unique identifier for the edge | |
| 199 | | `fromNode` | Yes | string | - | Node ID where connection starts | |
| 200 | | `fromSide` | No | string | - | Side where edge starts | |
| 201 | | `fromEnd` | No | string | `none` | Shape at edge start | |
| 202 | | `toNode` | Yes | string | - | Node ID where connection ends | |
| 203 | | `toSide` | No | string | - | Side where |