TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/kepano/obsidian-skills/llms.txt
Use this file to discover all available pages before exploring further.
json-canvas skill teaches AI coding assistants to create and edit JSON Canvas files — the .canvas format used by Obsidian for infinite visual canvases. Canvas files follow the JSON Canvas Spec 1.0 and contain nodes (text cards, file previews, web links, and groups) connected by directional edges. Load this skill when the user asks to work with .canvas files, create mind maps or flowcharts, or visualize relationships between notes.
File Structure
A canvas file (.canvas) is a JSON file with two top-level arrays:
nodes(optional): Array of node objects placed on the canvasedges(optional): Array of edge objects connecting nodes by theirid
Common Workflows
Create a New Canvas
Create a New Canvas
- Create a
.canvasfile with the base structure{"nodes": [], "edges": []} - Generate unique 16-character hex IDs for each node (e.g.,
"6f0ad84f44ce9c17") - Add nodes with required fields:
id,type,x,y,width,height - Add edges referencing valid node IDs via
fromNodeandtoNode - Validate: Parse the JSON to confirm it is valid. Verify all
fromNode/toNodevalues exist in the nodes array
Add a Node to an Existing Canvas
Add a Node to an Existing Canvas
- Read and parse the existing
.canvasfile - Generate a unique ID that does not collide with existing node or edge IDs
- Choose a position (
x,y) that avoids overlapping existing nodes — leave 50–100px spacing - Append the new node object to the
nodesarray - Optionally add edges connecting the new node to existing nodes
- Validate: Confirm all IDs are unique and all edge references resolve to existing nodes
Connect Two Nodes
Connect Two Nodes
- Identify the source and target node IDs
- Generate a unique edge ID
- Set
fromNodeandtoNodeto the source and target IDs - Optionally set
fromSide/toSide(top,right,bottom,left) for anchor points - Optionally set
labelfor descriptive text on the edge - Append the edge to the
edgesarray - Validate: Confirm both
fromNodeandtoNodereference existing node IDs
Edit an Existing Canvas
Edit an Existing Canvas
- Read and parse the
.canvasfile as JSON - Locate the target node or edge by
id - Modify the desired attributes (text, position, color, etc.)
- Write the updated JSON back to the file
- Validate: Re-check all ID uniqueness and edge reference integrity after editing
Node Types
All nodes share a set of generic attributes, plus type-specific fields. Array order determines z-index: first node = bottom layer, last node = top layer.Generic Node Attributes
| Attribute | Required | Type | Description |
|---|---|---|---|
id | Yes | string | Unique 16-char hex identifier |
type | Yes | string | text, file, link, or group |
x | Yes | integer | X position in pixels |
y | Yes | integer | Y position in pixels |
width | Yes | integer | Width in pixels |
height | Yes | integer | Height in pixels |
color | No | canvasColor | Preset "1"–"6" or hex (e.g., "#FF0000") |
- Text
- File
- Link
- Group
Text nodes display plain text with Markdown syntax rendered inside the card.
| Attribute | Required | Type | Description |
|---|---|---|---|
text | Yes | string | Plain text with Markdown syntax |
Edges
Edges connect nodes viafromNode and toNode IDs. Both ends can have optional directional arrows and anchor side hints.
| Attribute | Required | Type | Default | Description |
|---|---|---|---|---|
id | Yes | string | — | Unique identifier |
fromNode | Yes | string | — | Source node ID |
fromSide | No | string | — | top, right, bottom, or left |
fromEnd | No | string | none | none or arrow |
toNode | Yes | string | — | Target node ID |
toSide | No | string | — | top, right, bottom, or left |
toEnd | No | string | arrow | none or arrow |
color | No | canvasColor | — | Line color |
label | No | string | — | Text label on the edge |
Colors
ThecanvasColor type accepts either a hex string (e.g., "#FF0000") or one of the preset number strings. Preset colors are intentionally loosely defined — applications use their own brand colors.
| Preset | Color |
|---|---|
"1" | Red |
"2" | Orange |
"3" | Yellow |
"4" | Green |
"5" | Cyan |
"6" | Purple |
ID Generation
Generate 16-character lowercase hexadecimal strings (64-bit random values) for all node and edge IDs:nodes and edges arrays within a single canvas file.
Layout Guidelines
The canvas coordinate system extends infinitely in all directions. Coordinates can be negative.xincreases to the right;yincreases downward- Node position (
x,y) refers to the top-left corner - Space nodes 50–100px apart; leave 20–50px padding inside groups
- Align to grid (multiples of 10 or 20) for cleaner layouts
| 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 |
Validation Checklist
After creating or editing a canvas file, verify all of the following:- All
idvalues are unique across both nodes and edges - Every
fromNodeandtoNodereferences an existing node ID - Required fields are present for each node type (
textfor text nodes,filefor file nodes,urlfor link nodes) typeis one of:text,file,link,groupfromSide/toSidevalues are one of:top,right,bottom,leftfromEnd/toEndvalues are one of:none,arrow- Color presets are
"1"through"6"or a valid hex string (e.g.,"#FF0000") - JSON is valid and parseable