import MarkdownIt from "markdown-it"; import { getText, showRhs } from "plugos-silverbullet-syscall/editor"; import * as clientStore from "plugos-silverbullet-syscall/clientStore"; import { cleanMarkdown } from "./util"; 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 showRhs( `${css}${md.render(cleanMd)}`, 2 ); }