import { encode as HTMLEncode } from "he"; import markdownIt from "markdown-it"; import markdownItKatexPlugin from "./plugins/markdown-katex"; import hljs from "highlight.js"; import "./themes/github-dark.css"; import "./themes/github.css"; import { v4 } from "uuid"; const markdown = markdownIt({ html: false, typographer: true, highlight: function (code, lang) { const uuid = v4(); const theme = window.localStorage.getItem("theme") === "light" ? "github" : "github-dark"; if (lang && hljs.getLanguage(lang)) { try { return ( `
${lang || ""}
` +
hljs.highlight(code, { language: lang, ignoreIllegals: true }).value +
"` +
HTMLEncode(code) +
"