Overview
TheCanvasData interface represents the top-level structure of a canvas file in Obsidian. A canvas file is stored as JSON and contains collections of nodes and edges that make up the visual canvas.
Interface
Properties
An array of all nodes in the canvas. Each node can be one of four types: file, text, link, or group.The
AllCanvasNodeData type is a union of:CanvasFileData- A node linking to a file in the vaultCanvasTextData- A node containing plaintextCanvasLinkData- A node linking to an external resourceCanvasGroupData- A node representing a group container
An array of all edges (connections) in the canvas. Edges connect nodes together to show relationships.See CanvasEdgeData for details on edge properties.
Supports arbitrary additional keys for forward compatibility. This allows canvas files to contain custom properties that may be used by future versions or plugins.
Example
Usage
When working with canvas files programmatically, you’ll typically:- Read the canvas file as JSON
- Parse it into a
CanvasDataobject - Manipulate nodes and edges as needed
- Serialize back to JSON and save
Related Types
- CanvasNodeData - Base interface for all node types
- CanvasEdgeData - Interface for canvas edges
CanvasColor- Type for node and edge colors