Skip to content

obsidian/link

This module provides utilities for handling and updating links within Obsidian vaults. It includes functions to split paths, update links in files, and generate markdown links with various options.

InterfaceDescription
ConvertLinkParamsParams for convertLink.
EditBacklinksParamsParameters for editBacklinks.
EditLinksInContentParamsParameters for editLinksInContent.
EditLinksParamsParameters for editLinks.
ExtractLinkFileParamsParameters for extractLinkFile.
GenerateMarkdownLinkParamsParams for generateMarkdownLink.
GenerateRawMarkdownLinkParamsParams for generateRawMarkdownLink.
ShouldResetAliasParamsParams for shouldResetAlias.
SplitSubpathResultSplits a link into its link path and subpath.
UpdateFileUrlLinksInContentParamsParams for updateFileUrlLinksInContent.
UpdateFileUrlLinksInFileParamsParams for updateFileUrlLinksInFile.
UpdateLinkParamsParams for updateLink.
UpdateLinksInFileParamsParams for updateLinksInFile.
FunctionDescription
convertLinkConverts a link to a new path.
editBacklinksEdits the backlinks for a file or path.
editLinksEdits the links for a file or path.
editLinksInContentEdits the links in a content string.
extractLinkFileExtracts the file associated with a link.
fixFrontmatterMarkdownLinksFixes the frontmatter markdown links in the provided metadata cache.
generateMarkdownLinkGenerates a markdown link based on the provided parameters.
generateRawMarkdownLinkGenerates a raw markdown link based on the provided params.
getGenerateMarkdownLinkDefaultParamsFnsReturns the shared, mutable list of functions that provide default params for generateMarkdownLink. Each function is invoked on every generateMarkdownLink call and its result is merged into the params (later registrations take precedence over the built-in defaults, but never over explicitly passed params). Register entries by adding a GenerateMarkdownLinkDefaultParamsComponent to a component tree rather than mutating this list directly.
shouldResetAliasDetermines if the alias of a link should be reset.
splitSubpathSplits a link into its link path and subpath.
testAngleBracketsTests whether a link uses angle brackets, possibly embed: [title](<link>), ![title](<link>).
testEmbedTests whether a link is an embed link: ![[link]], ![title](link).
testLeadingDotTests whether a link has a leading dot, possibly embed: [[./link]], [title](./link), [title](<./link>), ![[./link]], ![title](./link), ![title](<./link>).
testLeadingSlashTests whether a link has a leading slash, possibly embed: [[/link]], [title](/link), [title](</link>), ![[/link]], ![title](/link), ![title](</link>).
testWikilinkTests whether a link is a wikilink, possibly embed: [[link]], ![[link]].
updateFileUrlLinksInContentNormalizes the file:// links in a content string to a pretty form, converting backslashes to forward slashes. Other links are left unchanged.
updateFileUrlLinksInFileNormalizes the file:// links in a file to a pretty form, converting backslashes to forward slashes. Other links are left unchanged.
updateLinkUpdates a link based on the provided parameters.
updateLinksInContentUpdates the links in a content string based on the provided parameters.
updateLinksInFileUpdates the links in a file based on the provided parameters.
TypeDescription
EditBacklinksOptionsOptions for editBacklinks.
EditLinksOptionsOptions for editLinks.
EnumDescription
LinkPathStyleA style of the link path.
LinkStyleA style of the link.