aboutsummaryrefslogblamecommitdiffstats
path: root/spring-front/src/parse_worker.js
blob: 8bcf0adc00100465a70c92d33daa2e22d7f3a540 (plain) (tree)























                                                                      
import mit from "markdown-it";
import mithljs from "markdown-it-highlightjs";
import mittexmath from "markdown-it-texmath";
import mitmmdtable from "markdown-it-multimd-table";
import katex from "katex";

const md = new mit({ html: true })
  .enable(["table"])
  .use(mittexmath, {
    engine: katex,
    delimiters: "gitlab",
    katexOptions: { macros: { "\\RR": "\\mathbb{R}" } },
  })
  .use(mitmmdtable)
  .use(mithljs, { inline: true, auto: true, code: true, hljs: hljs });

self.addEventListener(
  "message",
  (event) => {
    let htm = md.render(event.target.value);
    self.postMessage(htm);
  },
  false
);