1
0
silverbullet/plugs/markdown/markdown.ts

17 lines
420 B
TypeScript
Raw Normal View History

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