Skip to content

obsidian/augmentations/functions

FunctionDescription
addIconAdds an icon to the library.
arrayBufferToBase64Converts an ArrayBuffer to a base64 string.
arrayBufferToHexConverts an ArrayBuffer to a hex string.
base64ToArrayBufferConverts a base64 string to an ArrayBuffer.
debounceA standard debounce export function. Use this to have a time-delayed export function only be called once in a given timeframe.
displayTooltipManually trigger a tooltip that will appear over the provided element. To display a tooltip on hover, use setTooltip instead.
finishRenderMathFlush the MathJax stylesheet.
fuzzySearchFuzzy search.
getAllTagsCombines all tags from frontmatter and note content into a single array.
getBlobArrayBufferConverts a Blob to an ArrayBuffer.
getFrontMatterInfoGiven the contents of a file, get information about the frontmatter of the file, including whether there is a frontmatter block, the offsets of where it starts and ends, and the frontmatter text.
getIconCreate an SVG from an iconId. Returns null if no icon associated with the iconId.
getIconIdsGet the list of registered icons.
getLanguageGet the ISO code for the currently configured app language. Defaults to ‘en’. See https://github.com/obsidianmd/obsidian-translations?tab=readme-ov-file#existing-languages for list of options.
getLinkpathConverts the linktext to a linkpath.
hexToArrayBufferConverts a hex string to an ArrayBuffer.
htmlToMarkdownConverts HTML to a Markdown string.
iterateCacheRefsIterate links and embeds. If callback returns true, the iteration process will be interrupted.
iterateRefsIf callback returns true, the iteration process will be interrupted.
loadMathJaxLoad MathJax.
loadMermaidLoad Mermaid and return a promise to the global mermaid object. Can also use Window.mermaid after this promise resolves to get the same reference.
loadPdfJsLoad PDF.js and return a promise to the global pdfjsLib object. Can also use Window.pdfjsLib after this promise resolves to get the same reference.
loadPrismLoad Prism.js and return a promise to the global Prism object. Can also use Window.Prism after this promise resolves to get the same reference.
normalizePathNormalizes a path replacing all invalid symbols.
parseFrontMatterAliasesParses the frontmatter aliases from the frontmatter object.
parseFrontMatterEntryParses a frontmatter entry from the frontmatter object.
parseFrontMatterStringArrayParses a frontmatter string array from the frontmatter object.
parseFrontMatterTagsParses the frontmatter tags from the frontmatter object.
parseLinktextParses the linktext of a wikilink into its component parts.
parsePropertyIdSplit a Bases property ID into constituent parts.
parseYamlParses a YAML string into an object.
prepareFuzzySearchConstruct a fuzzy search callback that runs on a target string. Performance may be an issue if you are running the search for more than a few thousand times. If performance is a problem, consider using prepareSimpleSearch instead.
prepareQueryPrepare a query for fuzzy search.
prepareSimpleSearchConstruct a simple search callback that runs on a target string.
removeIconRemove a custom icon from the library.
renderMatchesRender the matches of a search.
renderMathRender some LaTeX math using the MathJax engine. Returns an HTMLElement. Requires calling finishRenderMath when rendering is all done to flush the MathJax stylesheet.
renderResultsRender the results of a search.
requireApiVersionReturns true if the API version is equal or higher than the requested version. Use this to limit export functionality that require specific API versions to avoid crashing on older Obsidian builds.
resolveSubpathResolve the given subpath to a reference in the obsidian#MetadataCache.
sanitizeHTMLToDomSanitize HTML to a DOM fragment.
setIconInsert an SVG into the element from an iconId. Does nothing if no icon associated with the iconId.
setTooltipSet a tooltip on an element.
sortSearchResultsSort search results.
stringifyYamlStringify a YAML object.
stripHeadingNormalizes headings for link matching by stripping out special characters and shrinking consecutive spaces.
stripHeadingForLinkPrepares headings for linking by stripping out some bad combinations of special characters that could break links.