Skip to content

getCanvasReferencesFromContent

Extracts the outgoing references of a canvas from its JSON content.

This is getCanvasReferences without the read: use it when the content is already in hand, for example inside an applyFileChanges changes provider, so the references describe exactly the content the changes will be applied to.

Import:

import { getCanvasReferencesFromContent } from '@mnaoumov/obsidian-lib/canvas';

Signature:

function getCanvasReferencesFromContent(app: App, content: string): Promise<CanvasReference[]>

Parameters:

Parameter Type Description
app App The Obsidian app instance.
content string The canvas JSON content.

Returns: Promise<CanvasReference[]> — A Promise that resolves to the canvas references, or an empty array when the content is not valid canvas JSON.