Skip to content

Instantly share code, notes, and snippets.

Created December 6, 2022 04:29
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Obsidian Canvas JSON format (TypeScript definition)
export type Side = 'top' | 'right' | 'bottom' | 'left';
export interface CanvasData {
nodes: (CanvasFileData | CanvasTextData | CanvasLinkData)[];
edges: CanvasEdgeData[];
export interface CanvasNodeData {
id: string;
x: number;
y: number;
width: number;
height: number;
color: string;
export interface CanvasEdgeData {
id: string;
fromNode: string;
fromSide: Side;
toNode: string;
toSide: Side;
color: string;
label: string;
export interface CanvasFileData extends CanvasNodeData {
type: 'file';
file: string;
export interface CanvasTextData extends CanvasNodeData {
type: 'text';
text: string;
export interface CanvasLinkData extends CanvasNodeData {
type: 'link';
url: string;
Copy link

Copy link

rstuven commented Mar 3, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment