UNPKG

ant-design-x-vue-next

Version:

Ant Design X for Vue — community continuation aligned with @ant-design/x

73 lines (72 loc) 1.91 kB
import { T as u } from "../../chunks/module-chunk.mjs"; const x = /^(?:\${1,2}([^$]{1,10000}?)\${1,2}|\\\(([\s\S]{1,10000}?)\\\)|\\\[((?:\\.|[^\\]){1,10000}?)\\\])/, k = /^(\${1,2})\n([\s\S]{1,10000}?)\n\1(?:\s*(?:\n|$))|^\\\[((?:\\.|[^\\]){1,10000}?)\\\]/; function l(n) { return n && n.replace(/\{align\*\}/g, "{aligned}"); } function c(n, i) { return (t) => u.renderToString(t.text, { ...n, displayMode: t.displayMode }) + ""; } function p(n, i) { return { name: "inlineKatex", level: "inline", start(t) { const e = t.indexOf("$"), r = t.indexOf("\\("), a = t.indexOf("\\["), o = [e, r, a].filter((s) => s !== -1); return o.length > 0 ? Math.min(...o) : void 0; }, tokenizer(t) { const e = t.match(x); if (!e) return; const r = e[1] || e[2] || e[3] || "", a = i ? l(r.trim()) : r.trim(), o = e[3] !== void 0, s = r.includes(` `), d = e[0].startsWith("$$") || e[0].startsWith("\\["); return { type: "inlineKatex", raw: e[0], text: a, displayMode: d, isBlock: o && s }; }, renderer: (t) => { const e = n(t); return t.isBlock ? `<div class="block-katex">${e}</div>` : `<span class="inline-katex">${e}</span>`; } }; } function f(n, i) { return { name: "blockKatex", level: "block", tokenizer(t) { const e = t.match(k); if (e) { let r = l(e[2] || e[3].trim()); return i && (r = l(r)), { type: "blockKatex", raw: e[0], text: r, displayMode: !0 }; } }, renderer: (t) => `<div class="block-katex">${n(t)}</div> ` }; } const h = (n) => { const { replaceAlignStart: i = !0, katexOptions: t } = n || {}, e = { output: "html", throwOnError: !1, ...t || {} }, r = c(e), a = c(e); return [ p(r, i), f(a, i) ]; }; export { h as default };