Skip to content

referenceDefinitionToFileChange

Builds the file change that replaces the destination of a reference-style link definition, leaving its id, its title and the rest of the note unchanged.

The destination keeps its form: one written in angle brackets stays in them, and a bare one stays bare unless the new destination cannot be written bare (it is empty, holds whitespace or a control character, starts with <, or has unbalanced parentheses), in which case it is written in angle brackets. Characters that would end or change the destination are escaped with a backslash.

Import:

import { referenceDefinitionToFileChange } from '@mnaoumov/obsidian-lib/reference-definition';

Signature:

function referenceDefinitionToFileChange(params: ReferenceDefinitionToFileChangeParams): FileChange | null

Parameters:

Parameter Type Description
params ReferenceDefinitionToFileChangeParams The parameters for building the file change.

Returns: FileChange | null — The file change, or null when the content at the definition’s position no longer holds a definition whose destination reads as ReferenceLinkCache.link, or when the new destination holds a line break, which no destination can.


Links to this page: