The MarkdownString represents human readable text that supports formatting via the markdown syntax. Standard markdown is supported, also tables, but no embedded html.

Implements

Constructors

Properties

#delegate: MarkdownStringImpl

Accessors

  • get baseUri(): undefined | Uri
  • Uri that relative paths are resolved relative to.

    If the baseUri ends with /, it is considered a directory and relative paths in the markdown are resolved relative to that directory:

    const md = new vscode.MarkdownString(`[link](./file.js)`);
    md.baseUri = vscode.Uri.file('/path/to/dir/');
    // Here 'link' in the rendered markdown resolves to '/path/to/dir/file.js'

    If the baseUri is a file, relative paths in the markdown are resolved relative to the parent dir of that file:

    const md = new vscode.MarkdownString(`[link](./file.js)`);
    md.baseUri = vscode.Uri.file('/path/to/otherFile.js');
    // Here 'link' in the rendered markdown resolves to '/path/to/file.js'

    Returns undefined | Uri

  • set baseUri(value): void
  • Uri that relative paths are resolved relative to.

    If the baseUri ends with /, it is considered a directory and relative paths in the markdown are resolved relative to that directory:

    const md = new vscode.MarkdownString(`[link](./file.js)`);
    md.baseUri = vscode.Uri.file('/path/to/dir/');
    // Here 'link' in the rendered markdown resolves to '/path/to/dir/file.js'

    If the baseUri is a file, relative paths in the markdown are resolved relative to the parent dir of that file:

    const md = new vscode.MarkdownString(`[link](./file.js)`);
    md.baseUri = vscode.Uri.file('/path/to/otherFile.js');
    // Here 'link' in the rendered markdown resolves to '/path/to/file.js'

    Parameters

    • value: undefined | Uri

    Returns void

  • get isTrusted(): undefined | boolean | MarkdownStringTrustedOptions
  • Indicates that this markdown string is from a trusted source. Only trusted markdown supports links that execute commands, e.g. [Run it](command:myCommandId).

    Defaults to false (commands are disabled).

    If this is an object, only the set of commands listed in enabledCommands are allowed.

    Returns undefined | boolean | MarkdownStringTrustedOptions

  • set isTrusted(value): void
  • Indicates that this markdown string is from a trusted source. Only trusted markdown supports links that execute commands, e.g. [Run it](command:myCommandId).

    Defaults to false (commands are disabled).

    If this is an object, only the set of commands listed in enabledCommands are allowed.

    Parameters

    • value: undefined | boolean | MarkdownStringTrustedOptions

    Returns void

Methods