UNPKG

1.81 kBTypeScriptView Raw
1import * as markdownit from 'markdown-it';
2import { MarkdownString } from '../../common/markdown-rendering/markdown-string';
3import { Disposable, DisposableGroup } from '../../common';
4import { LabelParser } from '../label-parser';
5export interface ContentActionHandler {
6 callback: (content: string, event?: MouseEvent) => void;
7 readonly disposables: DisposableGroup;
8}
9export interface FormattedTextRenderOptions {
10 readonly className?: string;
11 readonly inline?: boolean;
12 readonly actionHandler?: ContentActionHandler;
13 readonly renderCodeSegments?: boolean;
14}
15export interface MarkdownRenderResult extends Disposable {
16 element: HTMLElement;
17}
18export interface MarkdownRenderOptions extends FormattedTextRenderOptions {
19 readonly codeBlockRenderer?: (languageId: string, value: string) => Promise<HTMLElement>;
20 readonly asyncRenderCallback?: () => void;
21}
22/** Use this directly if you aren't worried about circular dependencies in the Shell */
23export declare const MarkdownRenderer: unique symbol;
24export interface MarkdownRenderer {
25 render(markdown: MarkdownString | undefined, options?: MarkdownRenderOptions): MarkdownRenderResult;
26}
27/** Use this to avoid circular dependencies in the Shell */
28export declare const MarkdownRendererFactory: unique symbol;
29export interface MarkdownRendererFactory {
30 (): MarkdownRenderer;
31}
32export declare class MarkdownRendererImpl implements MarkdownRenderer {
33 protected readonly labelParser: LabelParser;
34 protected readonly markdownIt: markdownit;
35 protected resetRenderer: Disposable | undefined;
36 protected init(): void;
37 render(markdown: MarkdownString | undefined, options?: MarkdownRenderOptions): MarkdownRenderResult;
38 protected markdownItPlugin(): void;
39}
40//# sourceMappingURL=markdown-renderer.d.ts.map
\No newline at end of file