Created
December 6, 2022 04:29
-
-
Save TfTHacker/52a6c3f3041a7043d152ef56af336ed6 to your computer and use it in GitHub Desktop.
Obsidian Canvas JSON format (TypeScript definition)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
Official TypeScript declaration file:
https://github.com/obsidianmd/obsidian-api/blob/master/canvas.d.ts
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Taken from Licat on Discord:
https://discord.com/channels/686053708261228577/716028884885307432/1049422491560452186