Skip to content

resolveSubpath

Official

Resolve the given subpath to a reference in the obsidian#MetadataCache.

Import:

import { resolveSubpath } from 'obsidian';

Example:

console.log(resolveSubpath(cache, '#foo'));

Signature:

function resolveSubpath(cache: CachedMetadata, subpath: string): BlockSubpathResult | FootnoteSubpathResult | HeadingSubpathResult | null

Parameters:

ParameterTypeDescription
cacheCachedMetadataThe cached metadata to resolve the subpath in.
subpathstringThe subpath to resolve.

Returns: BlockSubpathResult | FootnoteSubpathResult | HeadingSubpathResult | null — The resolved subpath or null if the subpath is not found.

Example:

console.log(resolveSubpath(cache, '#foo'));

Links to this page: