import MarkdownIt from "markdown-it"; import { getText, showPanel, } from "@silverbulletmd/plugos-silverbullet-syscall/editor"; import * as clientStore from "@silverbulletmd/plugos-silverbullet-syscall/clientStore"; import { cleanMarkdown } from "./util"; import { readSettings, writeSettings, } from "@silverbulletmd/plugs/lib/settings_page"; const css = ` `; var taskLists = require("markdown-it-task-lists"); 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)}` ); }