Skip to content

FileManager.generateMarkdownLink method

FileManager › generateMarkdownLink

Official

Generate a Markdown link based on the user's preferences.

Signature:

generateMarkdownLink(file: TFile, sourcePath: string, subpath?: string | undefined, alias?: string | undefined): string

Parameters:

ParameterTypeDescription
fileTFilethe file to link to.
sourcePathstringwhere the link is stored in, used to compute relative links.
subpath?string | undefinedA subpath, starting with #, used for linking to headings or blocks.
alias?string | undefinedThe display text if it's to be different than the file name. Pass empty string to use file name.

Returns: string

Since: 0.12.0