1
0
silverbullet/plugs/markdown/markdown.ts

17 lines
425 B
TypeScript
Raw Normal View History

2022-03-28 13:25:05 +00:00
import MarkdownIt from "markdown-it";
import { syscall } from "../lib/syscall";
var taskLists = require("markdown-it-task-lists");
const md = new MarkdownIt({
linkify: true,
html: false,
typographer: true,
}).use(taskLists);
export async function renderMarkdown() {
let text = await syscall("editor.getText");
let html = md.render(text);
await syscall("editor.showRhs", `<html><body>${html}</body></html>`);
}