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.
Import:
import { parseLinks } from '@mnaoumov/obsidian-lib/parse-link';Signature:
function parseLinks($string: string, options: ParseLinksOptions | undefined): ParseLinkResult[]Parameters:
| Parameter | Type | Description |
|---|---|---|
$string |
string | |
options |
ParseLinksOptions | undefined | The parse options. |
Returns: ParseLinkResult[] — The parsed links.
Links to this page: