markdown
Markdown to HTML with VS Code's renderer (the markdown preview's), falling back to escaped text.
import * as vscode from "vscode"; export async function markdown(md: string): Promise<string> { try { return await vscode.commands.executeCommand<string>("markdown.api.render", md); } catch { return `<pre>${md.replace(/[&<>]/g, (c) => ({ "&": "&", "<": "<", ">": ">" })[c]!)}</pre>`; } }