Skip to content

parse-link

This module provides utilities for parsing markdown and wiki links into structured data, and for escaping, unescaping, and encoding link components.

Interface Description
ParseFrontmatterLinksResult The result of parsing the links from a note’s frontmatter via parseFrontmatterLinks. Internal single-link frontmatter values are omitted, as Obsidian natively caches them.
ParseLinkFrontmatterReference A FrontmatterLinkCache for a link parsed from a single-link frontmatter value via parseLinks. It carries the full ParseLinkResult so consumers can inspect the parse details without re-parsing the link. Use this when the whole frontmatter value is a single link.
ParseLinkFrontmatterReferenceWithOffsets A ParseLinkFrontmatterReference for a link parsed from a multi-link frontmatter value via parseLinks, additionally carrying the offsets of the link within the frontmatter value. Use this when the frontmatter value holds multiple links.
ParseLinkReference A ReferenceCache for a link parsed from content via parseLinks. It carries the full ParseLinkResult so consumers can inspect the parse details without re-parsing the link.
ParseLinkResult A result of parsing a link.
ParseLinksOptions Options for parseLinks.
ToParseLinkReferenceParams Params for toParseLinkReference.
Function Description
escapeAlias Escapes the alias of a markdown link.
isParseLinkFrontmatterReference Determines whether a reference is a ParseLinkFrontmatterReference.
isParseLinkReference Determines whether a reference is a ParseLinkReference.
parseFrontmatterLinks Parses the links from a note’s frontmatter. Each string value is parsed via parseLinks: a value that is a single link yields an entry without offsets, and a value that holds multiple links yields offset-carrying entries. Internal single-link values are omitted, as Obsidian natively caches them.
parseLink Parses a link into its components.
parseLinks Parses all links in a string. Besides markdown links, wikilinks and autolinks, the plain text between them is scanned for bare URLs with a scheme (https://example.com) and, unless turned off through ParseLinksOptions.shouldRecognizeWwwAutolinkLiterals, for GFM extended www. autolink literals (www.example.com). Such a literal is reported as an external link whose url carries the http:// scheme Obsidian opens it with, so a link rebuilt from it stays external: a scheme-less [alias](www.example.com) is an internal link in Obsidian. A literal wrapped in <...> reports the brackets as part of raw, so replacing raw leaves no stray bracket behind.
toParseLinkReference Wraps a ParseLinkResult into a ParseLinkReference so it can flow through the reference-based file-change pipeline.
unescapeAlias Unescapes the alias of a markdown link.
Type Description
ParseLinkOptions Options for parseLink. The same as ParseLinksOptions.