Skip to content

getReferenceLinkText

Gets the text of the one link a reference stands for.

For most references that is Reference.original. A frontmatter link that carries offsets is the exception: its original is the WHOLE property value, which may hold several links, and startOffset / endOffset give this link’s span in it. Anything that parses, compares or replaces the link as one link must read that span, never the whole value.

Import:

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

Signature:

function getReferenceLinkText(reference: Reference): string

Parameters:

Parameter Type Description
reference Reference The reference.

Returns: string — The text of the link.