Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/markdown-language-features/src/commands/renderDocument.ts
3294 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { Command } from '../commandManager';
7
import { MarkdownItEngine } from '../markdownEngine';
8
import { ITextDocument } from '../types/textDocument';
9
10
export class RenderDocument implements Command {
11
public readonly id = 'markdown.api.render';
12
13
public constructor(
14
private readonly _engine: MarkdownItEngine
15
) { }
16
17
public async execute(document: ITextDocument | string): Promise<string> {
18
return (await (this._engine.render(document))).html;
19
}
20
}
21
22