import MarkdownIt from "https://esm.sh/markdown-it@13.0.1"; import { getText, showPanel, } from "../../syscall/silverbullet-syscall/editor.ts"; import * as clientStore from "../../syscall/silverbullet-syscall/clientStore.ts"; import { cleanMarkdown } from "./util.ts"; const css = ` `; import taskLists from "https://esm.sh/markdown-it-task-lists@2.1.1"; const md = new MarkdownIt({ linkify: true, html: false, typographer: true, }).use(taskLists); export async function updateMarkdownPreview() { if (!(await clientStore.get("enableMarkdownPreview"))) { return; } let text = await getText(); let cleanMd = await cleanMarkdown(text); await showPanel( "rhs", 2, `${css}${md.render(cleanMd)}`, ); }