Skip to content

MetadataCache.getFirstLinkpathDest method

MetadataCache › getFirstLinkpathDest

Official

Get the best match for a linkpath.

Signature:

getFirstLinkpathDest(linkpath: string, sourcePath: string): TFile | null

Parameters:

ParameterTypeDescription
linkpathstringThe linkpath.
sourcePathstringThe path of the file containing the link, used to resolve relative links.

Returns: TFile | null — The file, or null if no file matches.

Since: 0.12.5

Example:

console.log(metadataCache.getFirstLinkpathDest('foo/bar', 'baz/qux.md')); // `TFile` with path: 'baz/foo/bar.md' or 'some/other/path/foo/bar.md'