sussudio
Version:
An unofficial VS Code Internal API
35 lines (34 loc) • 1.85 kB
text/typescript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { FormattedTextRenderOptions } from "./formattedTextRenderer.mjs";
import { IMarkdownString } from "../common/htmlContent.mjs";
import { marked } from "../common/marked/marked.mjs";
export interface MarkedOptions extends marked.MarkedOptions {
baseUrl?: never;
}
export interface MarkdownRenderOptions extends FormattedTextRenderOptions {
readonly codeBlockRenderer?: (languageId: string, value: string) => Promise<HTMLElement>;
readonly asyncRenderCallback?: () => void;
}
/**
* Low-level way create a html element from a markdown string.
*
* **Note** that for most cases you should be using [`MarkdownRenderer`](./src/vs/editor/contrib/markdownRenderer/browser/markdownRenderer.ts)
* which comes with support for pretty code block rendering and which uses the default way of handling links.
*/
export declare function renderMarkdown(markdown: IMarkdownString, options?: MarkdownRenderOptions, markedOptions?: MarkedOptions): {
element: HTMLElement;
dispose: () => void;
};
export declare const allowedMarkdownAttr: string[];
/**
* Strips all markdown from `string`, if it's an IMarkdownString. For example
* `# Header` would be output as `Header`. If it's not, the string is returned.
*/
export declare function renderStringAsPlaintext(string: IMarkdownString | string): string;
/**
* Strips all markdown from `markdown`. For example `# Header` would be output as `Header`.
*/
export declare function renderMarkdownAsPlaintext(markdown: IMarkdownString): string;