Skip to content

getLinkpath

Official

Converts the linktext to a linkpath.

Import:

import { getLinkpath } from 'obsidian';

Example:

console.log(getLinkpath('foo#bar')); // foo

Signature:

function getLinkpath(linktext: string): string

Parameters:

ParameterTypeDescription
linktextstringA wikilink without the leading [[ and trailing ]].

Returns: string — the name of the file that is being linked to.

Example:

console.log(getLinkpath('foo#bar')); // foo