@toantranmei/editor 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -5
- package/dist/block-names-QblT9TgF.js +30 -0
- package/dist/block-names-QblT9TgF.js.map +1 -0
- package/dist/collaboration.js +42 -0
- package/dist/collaboration.js.map +1 -0
- package/dist/{css-BSGpc2It.js → css-el97DJfy.js} +201 -41
- package/dist/css-el97DJfy.js.map +1 -0
- package/dist/date-utils-DW99lT2W.js +1308 -0
- package/dist/date-utils-DW99lT2W.js.map +1 -0
- package/dist/index.js +2467 -2848
- package/dist/index.js.map +1 -1
- package/dist/nuxt.js +9 -8
- package/dist/nuxt.js.map +1 -1
- package/dist/render.js +445 -0
- package/dist/render.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/types/collaboration.d.ts +27 -0
- package/dist/types/components/MeiEditor.vue.d.ts +17 -3
- package/dist/types/components/MermaidDiagram.vue.d.ts +8 -5
- package/dist/types/composables/usePointerMoved.d.ts +10 -0
- package/dist/types/config.d.ts +3 -0
- package/dist/types/date-utils.d.ts +2 -2
- package/dist/types/define-block.d.ts +27 -1
- package/dist/types/extensions/code-block.d.ts +10 -0
- package/dist/types/extensions/code-languages.d.ts +2 -0
- package/dist/types/extensions/embed-url.d.ts +2 -0
- package/dist/types/extensions/embed.d.ts +2 -2
- package/dist/types/extensions/html-block.d.ts +2 -26
- package/dist/types/extensions/html-document.d.ts +26 -0
- package/dist/types/extensions/index.d.ts +6 -1
- package/dist/types/extensions/markdown-paste.d.ts +36 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/locale.d.ts +2 -0
- package/dist/types/render/highlight.d.ts +4 -0
- package/dist/types/render/html.d.ts +14 -0
- package/dist/types/render/icons.d.ts +2 -0
- package/dist/types/render/index.d.ts +51 -0
- package/dist/types/render/mermaid.d.ts +13 -0
- package/dist/types/render/nodes.d.ts +17 -0
- package/dist/types/render/types.d.ts +102 -0
- package/dist/types/safe-url.d.ts +19 -0
- package/dist/types/theme/tokens.d.ts +202 -0
- package/package.json +23 -7
- package/dist/css-BSGpc2It.js.map +0 -1
package/dist/nuxt.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as e } from "./css-el97DJfy.js";
|
|
2
|
+
import { n as t, t as n } from "./block-names-QblT9TgF.js";
|
|
2
3
|
import { addComponent as r, addPluginTemplate as i, addTemplate as a, defineNuxtModule as o, extendViteConfig as s } from "@nuxt/kit";
|
|
3
4
|
// src/nuxt.ts
|
|
4
5
|
var c = [
|
|
@@ -37,7 +38,7 @@ var c = [
|
|
|
37
38
|
},
|
|
38
39
|
setup(o, l) {
|
|
39
40
|
o.css && l.options.css.push("@toantranmei/editor/style.css");
|
|
40
|
-
let u =
|
|
41
|
+
let u = e(o.tokens);
|
|
41
42
|
if (u) {
|
|
42
43
|
let { dst: e } = a({
|
|
43
44
|
filename: "mei-editor-tokens.css",
|
|
@@ -52,23 +53,23 @@ var c = [
|
|
|
52
53
|
filePath: "@toantranmei/editor",
|
|
53
54
|
mode: "client"
|
|
54
55
|
}), o.blocks?.includes("math") && l.options.css.push("katex/dist/katex.min.css"), o.blocks?.length) {
|
|
55
|
-
let
|
|
56
|
-
if (
|
|
57
|
-
let
|
|
56
|
+
let e = o.blocks.filter((e) => !n.includes(e));
|
|
57
|
+
if (e.length) throw Error(`[@toantranmei/editor] Unknown block(s) in meiEditor.blocks: ${e.join(", ")}`);
|
|
58
|
+
let t = o.blocks.filter((e) => e !== "default"), r = [o.blocks.includes("default") ? "...defaultBlocks" : "", ...t].filter(Boolean).join(", ");
|
|
58
59
|
i({
|
|
59
60
|
filename: "mei-editor-blocks.client.mjs",
|
|
60
61
|
mode: "client",
|
|
61
62
|
getContents: () => [
|
|
62
63
|
"import { defineNuxtPlugin } from '#imports'",
|
|
63
|
-
`import { GLOBAL_BLOCKS_KEY, defaultBlocks${
|
|
64
|
+
`import { GLOBAL_BLOCKS_KEY, defaultBlocks${t.map((e) => `, ${e}`).join("")} } from '@toantranmei/editor'`,
|
|
64
65
|
`export default defineNuxtPlugin((nuxtApp) => { nuxtApp.vueApp.provide(GLOBAL_BLOCKS_KEY, [${r}]) })`
|
|
65
66
|
].join("\n")
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
69
|
o.prebundle && s((e) => {
|
|
69
70
|
e.optimizeDeps ??= {}, e.optimizeDeps.include ??= [];
|
|
70
|
-
let
|
|
71
|
-
e.optimizeDeps.include.push(...[...c, ...
|
|
71
|
+
let n = (o.blocks ?? []).map((e) => t[e]).filter((e) => !!e);
|
|
72
|
+
e.optimizeDeps.include.push(...[...c, ...n].map((e) => `@toantranmei/editor > ${e}`));
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
75
|
});
|
package/dist/nuxt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt.js","names":["
|
|
1
|
+
{"version":3,"file":"nuxt.js","names":["overridesCss","BLOCK_PEERS","BLOCK_NAMES","RUNTIME_DEPS","module","defineNuxtModule","options","nuxt","tokensCss","addTemplate","dst","addComponent","unknown","b","named","list","n","extendViteConfig","peers","p","dep"],"sources":["../src/nuxt.ts"],"sourcesContent":["import { addComponent, addPluginTemplate, addTemplate, defineNuxtModule, extendViteConfig } from '@nuxt/kit'\nimport type { NuxtModule } from '@nuxt/schema'\nimport { overridesCss } from './theme/css'\nimport type { ThemeTokens } from './theme/tokens'\nimport { BLOCK_NAMES, BLOCK_PEERS, type BlockName } from './block-names'\n\n/**\n * Bare imports in dist/index.js (everything except `vue`). Keep in sync when adding\n * imports; `pnpm --filter @toantranmei/editor check:deps` verifies it after a build.\n */\nexport const RUNTIME_DEPS = [\n '@floating-ui/dom',\n '@lucide/vue',\n '@tiptap/core',\n '@tiptap/extension-blockquote',\n '@tiptap/extension-code-block-lowlight',\n '@tiptap/extension-details',\n '@tiptap/extension-drag-handle-vue-3',\n '@tiptap/extension-heading',\n '@tiptap/extension-horizontal-rule',\n '@tiptap/extension-image',\n '@tiptap/extension-list',\n '@tiptap/extension-mention',\n '@tiptap/extension-node-range',\n '@tiptap/extension-table',\n '@tiptap/pm/model',\n '@tiptap/pm/state',\n '@tiptap/pm/tables',\n '@tiptap/pm/view',\n '@tiptap/starter-kit',\n '@tiptap/suggestion',\n '@tiptap/vue-3',\n '@tiptap/vue-3/menus',\n 'lowlight',\n]\n\nexport interface ModuleOptions {\n /** Name of the auto-registered component. */\n componentName: string\n /** Add the editor stylesheet to the app automatically. */\n css: boolean\n /**\n * Pre-bundle the editor and its Tiptap/ProseMirror deps in Vite dev. Keeps a single\n * ProseMirror instance and converts highlight.js (CommonJS). Disable only when\n * consuming the editor's source directly (like the monorepo playground).\n */\n prebundle: boolean\n /** Token overrides applied to every editor in the app (typed, with autocomplete). */\n tokens?: ThemeTokens\n /**\n * Blocks loaded by every editor without a `blocks` prop, e.g. `['default', 'math', 'toc']`.\n * Only the listed blocks are imported. For blocks with options (`file`, `mention`), use\n * a Nuxt plugin with `app.use(MeiEditorPlugin, { component: false, blocks: [...] })` instead.\n */\n blocks?: BlockName[]\n}\n\n/**\n * Nuxt module: registers <MeiEditor> as a client-only component and adds its CSS.\n *\n * @example\n * export default defineNuxtConfig({ modules: ['@toantranmei/editor/nuxt'] })\n */\nconst module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({\n meta: { name: '@toantranmei/editor', configKey: 'meiEditor' },\n defaults: { componentName: 'MeiEditor', css: true, prebundle: true },\n setup(options, nuxt) {\n if (options.css) nuxt.options.css.push('@toantranmei/editor/style.css')\n\n // App-wide token overrides compiled to a static stylesheet (no runtime cost).\n const tokensCss = overridesCss(options.tokens)\n if (tokensCss) {\n const { dst } = addTemplate({ filename: 'mei-editor-tokens.css', write: true, getContents: () => tokensCss })\n nuxt.options.css.push(dst)\n }\n\n addComponent({\n name: options.componentName,\n export: 'MeiEditor',\n filePath: '@toantranmei/editor',\n mode: 'client',\n })\n\n // KaTeX's stylesheet for the math block (see lazy.ts for why the library doesn't import it).\n if (options.blocks?.includes('math')) nuxt.options.css.push('katex/dist/katex.min.css')\n\n if (options.blocks?.length) {\n const unknown = options.blocks.filter(b => !BLOCK_NAMES.includes(b))\n if (unknown.length) throw new Error(`[@toantranmei/editor] Unknown block(s) in meiEditor.blocks: ${unknown.join(', ')}`)\n const named = options.blocks.filter(b => b !== 'default')\n const list = [options.blocks.includes('default') ? '...defaultBlocks' : '', ...named].filter(Boolean).join(', ')\n addPluginTemplate({\n filename: 'mei-editor-blocks.client.mjs',\n mode: 'client',\n getContents: () => [\n `import { defineNuxtPlugin } from '#imports'`,\n `import { GLOBAL_BLOCKS_KEY, defaultBlocks${named.map(n => `, ${n}`).join('')} } from '@toantranmei/editor'`,\n `export default defineNuxtPlugin((nuxtApp) => { nuxtApp.vueApp.provide(GLOBAL_BLOCKS_KEY, [${list}]) })`,\n ].join('\\n'),\n })\n }\n\n // Nuxt marks module packages as \"transpile\", which excludes them from pre-bundling,\n // so pre-bundle the editor's runtime deps instead (resolved from this package).\n if (options.prebundle) {\n extendViteConfig((config) => {\n config.optimizeDeps ??= {}\n config.optimizeDeps.include ??= []\n const peers = (options.blocks ?? []).map(b => BLOCK_PEERS[b]).filter((p): p is string => !!p)\n config.optimizeDeps.include.push(...[...RUNTIME_DEPS, ...peers].map(dep => `@toantranmei/editor > ${dep}`))\n })\n }\n },\n})\n\nexport default module\n"],"mappings":";;;;AAUA,IAAaG,IAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GA6BMC,IAAoCC,EAAgC;CACxE,MAAM;EAAE,MAAM;EAAuB,WAAW;CAAY;CAC5D,UAAU;EAAE,eAAe;EAAa,KAAK;EAAM,WAAW;CAAK;CACnE,MAAM,GAAS,GAAM;EACnB,AAAIC,EAAQ,OAAKC,EAAK,QAAQ,IAAI,KAAK,+BAA+B;EAGtE,IAAMC,IAAYR,EAAaM,EAAQ,MAAM;EAC7C,IAAIE,GAAW;GACb,IAAM,EAAE,WAAQC,EAAY;IAAE,UAAU;IAAyB,OAAO;IAAM,mBAAmBD;GAAU,CAAC;GAC5G,EAAK,QAAQ,IAAI,KAAKE,CAAG;EAC3B;EAYA,IAVAC,EAAa;GACX,MAAML,EAAQ;GACd,QAAQ;GACR,UAAU;GACV,MAAM;EACR,CAAC,GAGGA,EAAQ,QAAQ,SAAS,MAAM,KAAGC,EAAK,QAAQ,IAAI,KAAK,0BAA0B,GAElFD,EAAQ,QAAQ,QAAQ;GAC1B,IAAMM,IAAUN,EAAQ,OAAO,QAAO,MAAK,CAACJ,EAAY,SAASW,CAAC,CAAC;GACnE,IAAID,EAAQ,QAAQ,MAAU,MAAM,+DAA+DA,EAAQ,KAAK,IAAI,GAAG;GACvH,IAAME,IAAQR,EAAQ,OAAO,QAAO,MAAKO,MAAM,SAAS,GAClDE,IAAO,CAACT,EAAQ,OAAO,SAAS,SAAS,IAAI,qBAAqB,IAAI,GAAGQ,CAAK,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,IAAI;GAC/G,EAAkB;IAChB,UAAU;IACV,MAAM;IACN,mBAAmB;KACjB;KACA,4CAA4CA,EAAM,KAAI,MAAK,KAAKE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;KAC9E,6FAA6FD,EAAK;IACpG,CAAC,CAAC,KAAK,IAAI;GACb,CAAC;EACH;EAIA,AAAIT,EAAQ,aACVW,GAAkB,MAAW;GAE3B,AADA,EAAO,iBAAiB,CAAC,GACzB,EAAO,aAAa,YAAY,CAAC;GACjC,IAAMC,KAASZ,EAAQ,UAAU,CAAC,EAAA,CAAG,KAAI,MAAKL,EAAYY,EAAE,CAAC,CAAC,QAAQ,MAAmB,CAAC,CAACM,CAAC;GAC5F,EAAO,aAAa,QAAQ,KAAK,GAAG,CAAC,GAAGhB,GAAc,GAAGe,CAAK,CAAC,CAAC,KAAI,MAAO,yBAAyBE,GAAK,CAAC;EAC5G,CAAC;CAEL;AACF,CAAC"}
|
package/dist/render.js
ADDED
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { a as e, f as t, g as n, h as r, m as i, y as a } from "./date-utils-DW99lT2W.js";
|
|
2
|
+
import { i as o, t as s } from "./css-el97DJfy.js";
|
|
3
|
+
import { createLowlight as c } from "lowlight";
|
|
4
|
+
import l from "highlight.js/lib/languages/arduino";
|
|
5
|
+
import u from "highlight.js/lib/languages/bash";
|
|
6
|
+
import d from "highlight.js/lib/languages/c";
|
|
7
|
+
import f from "highlight.js/lib/languages/cpp";
|
|
8
|
+
import p from "highlight.js/lib/languages/csharp";
|
|
9
|
+
import m from "highlight.js/lib/languages/css";
|
|
10
|
+
import h from "highlight.js/lib/languages/diff";
|
|
11
|
+
import g from "highlight.js/lib/languages/go";
|
|
12
|
+
import _ from "highlight.js/lib/languages/graphql";
|
|
13
|
+
import v from "highlight.js/lib/languages/ini";
|
|
14
|
+
import y from "highlight.js/lib/languages/java";
|
|
15
|
+
import b from "highlight.js/lib/languages/javascript";
|
|
16
|
+
import ee from "highlight.js/lib/languages/json";
|
|
17
|
+
import te from "highlight.js/lib/languages/kotlin";
|
|
18
|
+
import ne from "highlight.js/lib/languages/less";
|
|
19
|
+
import re from "highlight.js/lib/languages/lua";
|
|
20
|
+
import ie from "highlight.js/lib/languages/makefile";
|
|
21
|
+
import ae from "highlight.js/lib/languages/markdown";
|
|
22
|
+
import oe from "highlight.js/lib/languages/objectivec";
|
|
23
|
+
import se from "highlight.js/lib/languages/perl";
|
|
24
|
+
import x from "highlight.js/lib/languages/php";
|
|
25
|
+
import ce from "highlight.js/lib/languages/python";
|
|
26
|
+
import le from "highlight.js/lib/languages/r";
|
|
27
|
+
import S from "highlight.js/lib/languages/ruby";
|
|
28
|
+
import C from "highlight.js/lib/languages/rust";
|
|
29
|
+
import w from "highlight.js/lib/languages/scss";
|
|
30
|
+
import T from "highlight.js/lib/languages/shell";
|
|
31
|
+
import E from "highlight.js/lib/languages/sql";
|
|
32
|
+
import D from "highlight.js/lib/languages/swift";
|
|
33
|
+
import ue from "highlight.js/lib/languages/typescript";
|
|
34
|
+
import de from "highlight.js/lib/languages/xml";
|
|
35
|
+
import fe from "highlight.js/lib/languages/yaml";
|
|
36
|
+
// src/render/html.ts
|
|
37
|
+
var pe = {
|
|
38
|
+
"&": "&",
|
|
39
|
+
"<": "<",
|
|
40
|
+
">": ">",
|
|
41
|
+
"\"": """,
|
|
42
|
+
"'": "'"
|
|
43
|
+
}, O = /[&<>"']/g;
|
|
44
|
+
function k(e) {
|
|
45
|
+
if (e == null) return "";
|
|
46
|
+
let t = String(e);
|
|
47
|
+
return O.test(t) ? t.replace(O, (e) => pe[e]) : t;
|
|
48
|
+
}
|
|
49
|
+
function A(e, t) {
|
|
50
|
+
return t == null || t === !1 ? "" : t === !0 ? ` ${e}` : ` ${e}="${k(t)}"`;
|
|
51
|
+
}
|
|
52
|
+
var j = /^data:(?:image\/(?:png|jpe?g|gif|webp|avif|bmp|x-icon|svg\+xml)|audio\/[\w.+-]+|video\/[\w.+-]+)[;,]/i, M = /^data:(?:text\/html|application\/xhtml|image\/svg|text\/xml|application\/xml|text\/javascript|application\/javascript)/i;
|
|
53
|
+
function N(e, t = "link") {
|
|
54
|
+
if (typeof e != "string") return null;
|
|
55
|
+
let n = e.trim();
|
|
56
|
+
if (!n) return null;
|
|
57
|
+
let r = n.replace(/[\u0000-\u001F\u007F\s]+/g, ""), i = /^([a-z][a-z0-9+.-]*):/i.exec(r)?.[1]?.toLowerCase();
|
|
58
|
+
if (t === "frame") return i === "http" || i === "https" ? n : null;
|
|
59
|
+
if (!i) return /^[\\]/.test(r) ? null : n;
|
|
60
|
+
if (i === "http" || i === "https") return n;
|
|
61
|
+
if (i === "mailto") return t === "link" ? n : null;
|
|
62
|
+
if (i === "data") {
|
|
63
|
+
if (t === "media") return j.test(r) ? n : null;
|
|
64
|
+
if (t === "download") return M.test(r) ? null : n;
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
var P = (e) => /^https?:\/\//i.test(e) || e.startsWith("//"), F = c({
|
|
69
|
+
arduino: l,
|
|
70
|
+
bash: u,
|
|
71
|
+
c: d,
|
|
72
|
+
cpp: f,
|
|
73
|
+
csharp: p,
|
|
74
|
+
css: m,
|
|
75
|
+
diff: h,
|
|
76
|
+
go: g,
|
|
77
|
+
graphql: _,
|
|
78
|
+
ini: v,
|
|
79
|
+
java: y,
|
|
80
|
+
javascript: b,
|
|
81
|
+
json: ee,
|
|
82
|
+
kotlin: te,
|
|
83
|
+
less: ne,
|
|
84
|
+
lua: re,
|
|
85
|
+
makefile: ie,
|
|
86
|
+
markdown: ae,
|
|
87
|
+
objectivec: oe,
|
|
88
|
+
perl: se,
|
|
89
|
+
php: x,
|
|
90
|
+
python: ce,
|
|
91
|
+
r: le,
|
|
92
|
+
ruby: S,
|
|
93
|
+
rust: C,
|
|
94
|
+
scss: w,
|
|
95
|
+
shell: T,
|
|
96
|
+
sql: E,
|
|
97
|
+
swift: D,
|
|
98
|
+
typescript: ue,
|
|
99
|
+
xml: de,
|
|
100
|
+
yaml: fe
|
|
101
|
+
});
|
|
102
|
+
function I(e) {
|
|
103
|
+
if (e.type === "text") return k(e.value ?? "");
|
|
104
|
+
let t = (e.children ?? []).map(I).join("");
|
|
105
|
+
if (e.type === "element") {
|
|
106
|
+
let n = e.properties?.className, r = (Array.isArray(n) ? n : n ? [n] : []).filter((e) => /^[\w-]+$/.test(e));
|
|
107
|
+
return r.length ? `<span class="${r.join(" ")}">${t}</span>` : `<span>${t}</span>`;
|
|
108
|
+
}
|
|
109
|
+
return t;
|
|
110
|
+
}
|
|
111
|
+
function L(e) {
|
|
112
|
+
if (!e) return null;
|
|
113
|
+
let t = n[e] ?? e;
|
|
114
|
+
return F.registered(t) ? t : null;
|
|
115
|
+
}
|
|
116
|
+
function R(e, t) {
|
|
117
|
+
let n = L(t);
|
|
118
|
+
if (!n) return k(e);
|
|
119
|
+
try {
|
|
120
|
+
return I(F.highlight(n, e));
|
|
121
|
+
} catch {
|
|
122
|
+
return k(e);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// src/render/nodes.ts
|
|
126
|
+
var z = (e) => e.state, B = (e) => e.type === "text" ? e.text ?? "" : (e.content ?? []).map(B).join(""), me = (e) => e.normalize("NFKD").replace(/[̀-ͯ]/g, "").replace(/đ/gi, "d").toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "").slice(0, 64) || "section";
|
|
127
|
+
function he(e) {
|
|
128
|
+
let t = [], n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Set(), i = (e, t) => {
|
|
129
|
+
let i = typeof e.attrs?.id == "string" && e.attrs.id ? e.attrs.id : me(t);
|
|
130
|
+
if (r.has(i)) {
|
|
131
|
+
let e = 2;
|
|
132
|
+
for (; r.has(`${i}-${e}`);) e++;
|
|
133
|
+
i = `${i}-${e}`;
|
|
134
|
+
}
|
|
135
|
+
return r.add(i), n.set(e, i), i;
|
|
136
|
+
}, a = (e) => {
|
|
137
|
+
if (e.type === "heading") {
|
|
138
|
+
let n = B(e);
|
|
139
|
+
t.push({
|
|
140
|
+
level: Number(e.attrs?.level) || 1,
|
|
141
|
+
text: n,
|
|
142
|
+
id: i(e, n)
|
|
143
|
+
});
|
|
144
|
+
} else {
|
|
145
|
+
if (e.type === "details" && e.attrs?.level) {
|
|
146
|
+
let n = e.content?.[0] ? B(e.content[0]) : "";
|
|
147
|
+
t.push({
|
|
148
|
+
level: Number(e.attrs.level) || 1,
|
|
149
|
+
text: n,
|
|
150
|
+
id: i(e, n)
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (e.type !== "text" && e.content) for (let t of e.content) a(t);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
return e && a(e), {
|
|
157
|
+
headings: t,
|
|
158
|
+
anchorOf: n
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
var V = (e, t, n, r) => {
|
|
162
|
+
let i = Number(e);
|
|
163
|
+
return Number.isFinite(i) ? Math.min(n, Math.max(t, i)) : r;
|
|
164
|
+
}, H = (e) => typeof e == "number" && Number.isFinite(e) ? e : null, ge = /^[a-z]+$/, U = (e) => typeof e == "string" && ge.test(e) ? e : null, W = (e, t = "") => ((n, r) => `<${e}${t}${r.blockAttrs(n)}>${r.children(n)}</${e}>`);
|
|
165
|
+
function G(e, t) {
|
|
166
|
+
let n = (t.options.externalLinksInNewTab ?? !0) && P(e);
|
|
167
|
+
return `${A("href", e)}${n ? " target=\"_blank\" rel=\"noopener noreferrer nofollow\"" : ""}`;
|
|
168
|
+
}
|
|
169
|
+
function K(e, t, n) {
|
|
170
|
+
let r = z(n).katex;
|
|
171
|
+
if (r) try {
|
|
172
|
+
return r.renderToString(e, {
|
|
173
|
+
displayMode: t,
|
|
174
|
+
throwOnError: !1,
|
|
175
|
+
trust: !1,
|
|
176
|
+
strict: "ignore",
|
|
177
|
+
output: "htmlAndMathml"
|
|
178
|
+
});
|
|
179
|
+
} catch {}
|
|
180
|
+
return `<code class="me-math-source">${k(e)}</code>`;
|
|
181
|
+
}
|
|
182
|
+
function _e(e) {
|
|
183
|
+
let t = Number(e);
|
|
184
|
+
if (!t || !Number.isFinite(t) || t < 0) return "";
|
|
185
|
+
let n = [
|
|
186
|
+
"B",
|
|
187
|
+
"KB",
|
|
188
|
+
"MB",
|
|
189
|
+
"GB"
|
|
190
|
+
], r = Math.min(n.length - 1, Math.floor(Math.log(t) / Math.log(1024)));
|
|
191
|
+
return `${(t / 1024 ** r).toFixed(+!!r)} ${n[r]}`;
|
|
192
|
+
}
|
|
193
|
+
var q = {
|
|
194
|
+
file: "file",
|
|
195
|
+
audio: "audio",
|
|
196
|
+
video: "video"
|
|
197
|
+
}, ve = {
|
|
198
|
+
doc: (e, t) => t.children(e),
|
|
199
|
+
paragraph: W("p"),
|
|
200
|
+
hardBreak: () => "<br>",
|
|
201
|
+
heading: (e, t) => {
|
|
202
|
+
let n = V(e.attrs?.level, 1, 6, 1);
|
|
203
|
+
return `<h${n}${A("id", z(t).anchorOf.get(e))}${t.blockAttrs(e)}>${t.children(e)}</h${n}>`;
|
|
204
|
+
},
|
|
205
|
+
blockquote: W("blockquote"),
|
|
206
|
+
horizontalRule: (e, t) => `<hr${t.blockAttrs(e)}>`,
|
|
207
|
+
bulletList: W("ul"),
|
|
208
|
+
orderedList: (e, t) => {
|
|
209
|
+
let n = H(e.attrs?.start);
|
|
210
|
+
return `<ol${n !== null && n !== 1 ? A("start", Math.trunc(n)) : ""}${t.blockAttrs(e)}>${t.children(e)}</ol>`;
|
|
211
|
+
},
|
|
212
|
+
listItem: W("li"),
|
|
213
|
+
taskList: W("ul", " data-type=\"taskList\""),
|
|
214
|
+
taskItem: (e, t) => {
|
|
215
|
+
let n = !!e.attrs?.checked;
|
|
216
|
+
return `<li data-type="taskItem" data-checked="${n}"${t.blockAttrs(e)}><label><input type="checkbox" tabindex="-1" aria-readonly="true"${n ? " checked" : ""}><span></span></label><div>${t.children(e)}</div></li>`;
|
|
217
|
+
},
|
|
218
|
+
codeBlock: (e, t) => {
|
|
219
|
+
let n = t.text(e), r = typeof e.attrs?.language == "string" ? e.attrs.language : "", i = /^[\w+#.-]{1,32}$/.test(r) ? r : "plaintext";
|
|
220
|
+
return i === "mermaid" ? `<div class="me-code-block me-mermaid-block"${t.blockAttrs(e)}><pre class="mermaid">${k(n)}</pre></div>` : `<div class="me-code-block"${t.blockAttrs(e)}><div class="me-block-bar me-code-toolbar"><span class="me-code-lang">${k(i)}</span></div><pre><code class="hljs language-${k(i)}">${R(n, i)}</code></pre></div>`;
|
|
221
|
+
},
|
|
222
|
+
image: (e, t) => {
|
|
223
|
+
let n = e.attrs ?? {}, r = t.safeUrl(n.src, "media");
|
|
224
|
+
if (!r) return "";
|
|
225
|
+
let i = V(n.width, 1, 100, 100), a = ["left", "right"].includes(n.align) ? n.align : "center", o = n.crop && typeof n.crop == "object" ? n.crop : null, s = o && [
|
|
226
|
+
o.x,
|
|
227
|
+
o.y,
|
|
228
|
+
o.w,
|
|
229
|
+
o.h,
|
|
230
|
+
o.ratio
|
|
231
|
+
].every((e) => H(e) !== null) && o.w > 0 && o.h > 0 && o.ratio > 0 ? o : null, c = s ? ` style="width:${100 / s.w}%;left:${-s.x / s.w * 100}%;top:${-s.y / s.h * 100}%"` : "", l = typeof n.caption == "string" ? n.caption : "", u = (n.showCaption ?? !!l) && l;
|
|
232
|
+
return `<div class="me-media"${t.blockAttrs(e)}><figure class="me-figure me-figure--${a}" style="width:${i}%"><div class="me-figure-frame"><div class="me-figure-media${s ? " is-cropped" : ""}"${s ? ` style="aspect-ratio:${s.ratio}"` : ""}><img class="me-figure-img"${A("src", r)}${A("alt", n.alt ?? "")}${A("title", n.title)} loading="lazy" decoding="async"${c}></div></div>${u ? `<figcaption class="me-caption">${k(l)}</figcaption>` : ""}</figure></div>`;
|
|
233
|
+
},
|
|
234
|
+
embed: (e, t) => {
|
|
235
|
+
let n = t.safeUrl(typeof e.attrs?.src == "string" ? r(e.attrs.src) : null, "frame");
|
|
236
|
+
if (!n) return "";
|
|
237
|
+
let i = Math.round(V(e.attrs?.height, 50, 2e3, 400));
|
|
238
|
+
return `<div class="me-media"${t.blockAttrs(e)}><div class="me-embed"><iframe class="me-embed-frame"${A("src", n)} height="${i}" sandbox="allow-scripts allow-same-origin allow-popups allow-presentation" allowfullscreen loading="lazy" referrerpolicy="strict-origin-when-cross-origin"></iframe></div></div>`;
|
|
239
|
+
},
|
|
240
|
+
callout: (e, t) => {
|
|
241
|
+
let n = typeof e.attrs?.icon == "string" ? e.attrs.icon : "💡";
|
|
242
|
+
return `<div class="me-callout" data-type="callout"${A("data-color", U(e.attrs?.color) ?? "gray")}${t.blockAttrs(e)}><div class="me-callout-icon-wrap"><span class="me-callout-icon">${k(n)}</span></div><div class="me-callout-content">${t.children(e)}</div></div>`;
|
|
243
|
+
},
|
|
244
|
+
details: (e, t) => {
|
|
245
|
+
let n = e.attrs?.level ? V(e.attrs.level, 1, 3, 1) : null;
|
|
246
|
+
return `<details class="me-toggle" data-type="details"${A("id", z(t).anchorOf.get(e))}${n ? ` data-level="${n}"` : ""}${e.attrs?.open ? " open" : ""}${t.blockAttrs(e)}>${t.children(e)}</details>`;
|
|
247
|
+
},
|
|
248
|
+
detailsSummary: (e, t) => `<summary${t.blockAttrs(e)}><span class="me-toggle-arrow" aria-hidden="true"></span><span class="me-toggle-title">${t.children(e)}</span></summary>`,
|
|
249
|
+
detailsContent: (e, t) => `<div data-type="detailsContent">${t.children(e)}</div>`,
|
|
250
|
+
table: (e, t) => {
|
|
251
|
+
let n = e.content?.[0]?.content ?? [], r = [];
|
|
252
|
+
for (let e of n) {
|
|
253
|
+
let t = V(e.attrs?.colspan, 1, 100, 1), n = Array.isArray(e.attrs?.colwidth) ? e.attrs.colwidth : [];
|
|
254
|
+
for (let e = 0; e < t; e++) r.push(H(n[e]));
|
|
255
|
+
}
|
|
256
|
+
let i = r.some((e) => e !== null) ? `<colgroup>${r.map((e) => e === null ? "<col>" : `<col style="width:${Math.max(1, Math.round(e))}px">`).join("")}</colgroup>` : "";
|
|
257
|
+
return `<div class="tableWrapper"${t.blockAttrs(e)}><table>${i}<tbody>${t.children(e)}</tbody></table></div>`;
|
|
258
|
+
},
|
|
259
|
+
tableRow: (e, t) => `<tr>${t.children(e)}</tr>`,
|
|
260
|
+
tableHeader: (e, t) => J("th", e, t),
|
|
261
|
+
tableCell: (e, t) => J("td", e, t),
|
|
262
|
+
columns: (e, t) => `<div class="me-columns" data-type="columns" style="--cols:${e.content?.length ?? 2}"${t.blockAttrs(e)}>${t.children(e)}</div>`,
|
|
263
|
+
column: (e, t) => `<div class="me-column" data-type="column">${t.children(e)}</div>`,
|
|
264
|
+
tableOfContents: (e, t) => {
|
|
265
|
+
let { headings: n } = z(t);
|
|
266
|
+
if (!n.length) return "";
|
|
267
|
+
let r = Math.min(...n.map((e) => e.level), 4), i = n.map((e) => `<a class="me-toc-item" data-depth="${e.level - r}" href="#${encodeURIComponent(e.id)}">${k(e.text || t.messages.toc.untitled)}</a>`).join("");
|
|
268
|
+
return `<nav class="me-toc"${A("aria-label", t.messages.toc.title)}${t.blockAttrs(e)}>${i}</nav>`;
|
|
269
|
+
},
|
|
270
|
+
mathBlock: (e, t) => {
|
|
271
|
+
let n = typeof e.attrs?.latex == "string" ? e.attrs.latex : "";
|
|
272
|
+
return n.trim() ? `<div class="me-math-block" data-type="math-block"${t.blockAttrs(e)}><span class="me-math-render">${K(n, !0, t)}</span></div>` : "";
|
|
273
|
+
},
|
|
274
|
+
mathInline: (e, t) => {
|
|
275
|
+
let n = typeof e.attrs?.latex == "string" ? e.attrs.latex : "";
|
|
276
|
+
return n.trim() ? `<span class="me-math-inline" data-type="math-inline"><span class="me-math-render">${K(n, !1, t)}</span></span>` : "";
|
|
277
|
+
},
|
|
278
|
+
fileBlock: (e, t) => {
|
|
279
|
+
let n = e.attrs ?? {}, r = q[n.kind] ? n.kind : "file";
|
|
280
|
+
if (!n.src) return "";
|
|
281
|
+
let i = r === "file" ? null : t.safeUrl(n.src, "media"), a = t.safeUrl(n.src, "download"), o = typeof n.name == "string" && n.name ? n.name : a ? String(n.src).slice(0, 200) : "", s = _e(n.size);
|
|
282
|
+
return `<div class="me-media"${t.blockAttrs(e)}><div class="me-file me-file--${r}">` + (i ? `<${r} class="me-file-player"${A("src", i)} controls preload="metadata"></${r}>` : "") + `<div class="me-file-row">${t.icon(q[r]).replace("class=\"lucide\"", "class=\"lucide me-file-icon\"")}<span class="me-file-name">${k(o)}</span>` + (s ? `<span class="me-file-size">${s}</span>` : "") + (a ? `<a class="me-tool-btn"${A("href", a)}${A("download", n.name || !0)} target="_blank" rel="noopener noreferrer"${A("title", t.messages.image.download)}>${t.icon("download")}</a>` : "") + "</div></div></div>";
|
|
283
|
+
},
|
|
284
|
+
mention: (t, n) => {
|
|
285
|
+
let r = t.attrs ?? {}, i = r.kind === "page" || r.kind === "date" ? r.kind : "user";
|
|
286
|
+
if (i === "date") {
|
|
287
|
+
let t = {
|
|
288
|
+
start: r.id,
|
|
289
|
+
end: r.end,
|
|
290
|
+
time: r.time,
|
|
291
|
+
endTime: r.endTime,
|
|
292
|
+
format: r.format ?? "relative",
|
|
293
|
+
timeFormat: r.timeFormat,
|
|
294
|
+
remind: r.remind
|
|
295
|
+
}, i;
|
|
296
|
+
try {
|
|
297
|
+
i = e(t, n.locale, n.messages.mention);
|
|
298
|
+
} catch {
|
|
299
|
+
i = String(r.label ?? r.id ?? "");
|
|
300
|
+
}
|
|
301
|
+
return `<span class="me-mention me-mention--date" data-type="mention" data-kind="date"><span>@${k(i)}</span></span>`;
|
|
302
|
+
}
|
|
303
|
+
let a = String(r.label ?? r.id ?? ""), o = n.options.mentionHref ? n.options.mentionHref({
|
|
304
|
+
id: String(r.id ?? ""),
|
|
305
|
+
label: r.label,
|
|
306
|
+
kind: i,
|
|
307
|
+
href: r.href
|
|
308
|
+
}) : r.href, s = n.safeUrl(o, "link"), c = `${i === "page" ? n.icon("fileText").replace("class=\"lucide\"", "class=\"lucide me-mention-icon\"") : (() => {
|
|
309
|
+
let e = n.safeUrl(r.avatar, "media");
|
|
310
|
+
return e ? `<img class="me-mention-avatar"${A("src", e)} alt="" loading="lazy">` : "";
|
|
311
|
+
})()}<span>${i === "page" ? "" : "@"}${k(a)}</span>`, l = `me-mention me-mention--${i}`, u = `data-type="mention" data-kind="${i}"${A("data-id", r.id)}`;
|
|
312
|
+
return s ? `<a class="${l}" ${u}${G(s, n)}>${c}</a>` : `<span class="${l}" ${u}>${c}</span>`;
|
|
313
|
+
},
|
|
314
|
+
htmlBlock: (e, n) => {
|
|
315
|
+
let r = typeof e.attrs?.code == "string" ? e.attrs.code : "";
|
|
316
|
+
if (!r.trim()) return "";
|
|
317
|
+
let { network: a, defaultHeight: o } = z(n).htmlOptions, s = Math.round(V(e.attrs?.height ?? o, 120, t, o)), c = typeof e.attrs?.fileName == "string" && e.attrs.fileName ? e.attrs.fileName : n.messages.html.title;
|
|
318
|
+
return `<div class="me-html"${n.blockAttrs(e)}><div class="me-html-frame"><div class="me-html-body" style="height:${s}px"><iframe class="me-html-iframe is-live"${A("srcdoc", i(r, a))} sandbox="allow-scripts allow-forms allow-modals allow-popups allow-pointer-lock allow-downloads"${A("title", c)} loading="lazy" referrerpolicy="no-referrer"></iframe></div></div></div>`;
|
|
319
|
+
},
|
|
320
|
+
unknownBlock: (e, t) => e.attrs?.data && typeof e.attrs.data == "object" && e.attrs.data.type !== "unknownBlock" ? t.render(e.attrs.data) : "",
|
|
321
|
+
unknownInline: (e, t) => e.attrs?.data && typeof e.attrs.data == "object" && e.attrs.data.type !== "unknownInline" ? t.render(e.attrs.data) : ""
|
|
322
|
+
};
|
|
323
|
+
function J(e, t, n) {
|
|
324
|
+
let r = t.attrs ?? {}, i = V(r.colspan, 1, 100, 1), a = V(r.rowspan, 1, 1e3, 1);
|
|
325
|
+
return `<${e}${i > 1 ? ` colspan="${i}"` : ""}${a > 1 ? ` rowspan="${a}"` : ""}${A("data-color", U(r.color))}>${n.children(t)}</${e}>`;
|
|
326
|
+
}
|
|
327
|
+
var Y = (e) => (t, n) => `<${e}>${n}</${e}>`, ye = {
|
|
328
|
+
bold: Y("strong"),
|
|
329
|
+
italic: Y("em"),
|
|
330
|
+
underline: Y("u"),
|
|
331
|
+
strike: Y("s"),
|
|
332
|
+
code: Y("code"),
|
|
333
|
+
subscript: Y("sub"),
|
|
334
|
+
superscript: Y("sup"),
|
|
335
|
+
highlight: Y("mark"),
|
|
336
|
+
link: (e, t, n) => {
|
|
337
|
+
let r = n.safeUrl(e.attrs?.href, "link");
|
|
338
|
+
return r ? `<a${G(r, n)}>${t}</a>` : t;
|
|
339
|
+
},
|
|
340
|
+
textColor: (e, t) => {
|
|
341
|
+
let n = U(e.attrs?.color);
|
|
342
|
+
return n ? `<span data-text-color="${n}">${t}</span>` : t;
|
|
343
|
+
},
|
|
344
|
+
bgColor: (e, t) => {
|
|
345
|
+
let n = U(e.attrs?.color);
|
|
346
|
+
return n ? `<mark data-bg-color="${n}">${t}</mark>` : t;
|
|
347
|
+
}
|
|
348
|
+
}, be = {
|
|
349
|
+
file: "<path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\"/><path d=\"M14 2v5a1 1 0 0 0 1 1h5\"/>",
|
|
350
|
+
fileText: "<path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\"/><path d=\"M14 2v5a1 1 0 0 0 1 1h5\"/><path d=\"M10 9H8\"/><path d=\"M16 13H8\"/><path d=\"M16 17H8\"/>",
|
|
351
|
+
fileQuestion: "<path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\"/><path d=\"M12 17h.01\"/><path d=\"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3\"/>",
|
|
352
|
+
audio: "<path d=\"M2 10v3\"/><path d=\"M6 6v11\"/><path d=\"M10 3v18\"/><path d=\"M14 8v7\"/><path d=\"M18 5v13\"/><path d=\"M22 10v3\"/>",
|
|
353
|
+
video: "<rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\"/><path d=\"M7 3v18\"/><path d=\"M3 7.5h4\"/><path d=\"M3 12h18\"/><path d=\"M3 16.5h4\"/><path d=\"M17 3v18\"/><path d=\"M17 7.5h4\"/><path d=\"M17 16.5h4\"/>",
|
|
354
|
+
download: "<path d=\"M12 15V3\"/><path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"/><path d=\"m7 10 5 5 5-5\"/>"
|
|
355
|
+
};
|
|
356
|
+
function xe(e, t = "") {
|
|
357
|
+
let n = be[e];
|
|
358
|
+
return n ? `<svg class="lucide${t ? ` ${t}` : ""}" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n}</svg>` : "";
|
|
359
|
+
}
|
|
360
|
+
// src/render/mermaid.ts
|
|
361
|
+
async function Se(e, t = {}) {
|
|
362
|
+
if (typeof document > "u") return;
|
|
363
|
+
let n = [...(e ?? document).querySelectorAll("pre.mermaid:not([data-processed])")];
|
|
364
|
+
if (!n.length) return;
|
|
365
|
+
let r = (await import("mermaid")).default, i = t.dark ?? document.documentElement.classList.contains("dark");
|
|
366
|
+
r.initialize({
|
|
367
|
+
startOnLoad: !1,
|
|
368
|
+
securityLevel: "strict",
|
|
369
|
+
theme: i ? "dark" : "default"
|
|
370
|
+
}), await r.run({
|
|
371
|
+
nodes: n,
|
|
372
|
+
suppressErrors: !0
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
// src/render/index.ts
|
|
376
|
+
var X = /^[a-z]+$/;
|
|
377
|
+
function Z(e, t = {}) {
|
|
378
|
+
let n = t.locale ?? "vi", r = t.blocks ?? [], i = a(n, ...r.map((e) => e.messages?.[n]), t.messages), o = { ...ve }, s = { ...ye };
|
|
379
|
+
for (let e of r) Object.assign(o, e.render?.nodes), Object.assign(s, e.render?.marks);
|
|
380
|
+
let c = r.find((e) => e.name === "html")?.options ?? {}, { headings: l, anchorOf: u } = he(e), d = {
|
|
381
|
+
headings: l,
|
|
382
|
+
anchorOf: u,
|
|
383
|
+
katex: t.katex ?? null,
|
|
384
|
+
htmlOptions: {
|
|
385
|
+
network: c.network ?? !1,
|
|
386
|
+
defaultHeight: c.defaultHeight ?? 400
|
|
387
|
+
}
|
|
388
|
+
}, f = (e) => {
|
|
389
|
+
let t = k(e.text ?? ""), n = e.marks ?? [];
|
|
390
|
+
for (let e = n.length - 1; e >= 0; e--) {
|
|
391
|
+
let r = n[e], i = s[r.type];
|
|
392
|
+
t = i ? i(r, t, _) : t;
|
|
393
|
+
}
|
|
394
|
+
return t;
|
|
395
|
+
}, p = (e) => {
|
|
396
|
+
if (!e || typeof e != "object") return "";
|
|
397
|
+
if (e.type === "text") return f(e);
|
|
398
|
+
let t = e.type ? o[e.type] : void 0;
|
|
399
|
+
return t ? t(e, _) : e.content?.length ? `<div${A("data-type", e.type)}${h(e)}>${m(e)}</div>` : "";
|
|
400
|
+
}, m = (e) => {
|
|
401
|
+
let t = e.content;
|
|
402
|
+
if (!t?.length) return "";
|
|
403
|
+
let n = "";
|
|
404
|
+
for (let e of t) n += p(e);
|
|
405
|
+
return n;
|
|
406
|
+
}, h = (e) => {
|
|
407
|
+
let t = e.attrs;
|
|
408
|
+
if (!t) return "";
|
|
409
|
+
let n = A("data-id", t.id);
|
|
410
|
+
return typeof t.blockColor == "string" && X.test(t.blockColor) && (n += ` data-text-color="${t.blockColor}"`), typeof t.blockBg == "string" && X.test(t.blockBg) && (n += ` data-bg-color="${t.blockBg}"`), n;
|
|
411
|
+
}, g = (e) => e.type === "text" ? e.text ?? "" : e.type === "hardBreak" ? "\n" : (e.content ?? []).map(g).join(""), _ = {
|
|
412
|
+
locale: n,
|
|
413
|
+
messages: i,
|
|
414
|
+
options: t,
|
|
415
|
+
children: m,
|
|
416
|
+
render: p,
|
|
417
|
+
blockAttrs: h,
|
|
418
|
+
escape: k,
|
|
419
|
+
attr: A,
|
|
420
|
+
safeUrl: N,
|
|
421
|
+
text: g,
|
|
422
|
+
icon: (e) => xe(e),
|
|
423
|
+
state: d
|
|
424
|
+
}, v = e ? p(e.type ? e : {
|
|
425
|
+
type: "doc",
|
|
426
|
+
content: []
|
|
427
|
+
}) : "";
|
|
428
|
+
return t.wrap === !1 ? v : `<div class="me-scope me-root me-render${t.theme === "light" ? " me-light" : t.theme === "dark" ? " me-dark" : ""}${t.className ? ` ${k(t.className)}` : ""}"><div class="me-content">${v}</div></div>`;
|
|
429
|
+
}
|
|
430
|
+
function Q(e) {
|
|
431
|
+
return e ? e.type === "mathBlock" || e.type === "mathInline" ? !0 : e.content?.some(Q) ?? !1 : !1;
|
|
432
|
+
}
|
|
433
|
+
var $ = null;
|
|
434
|
+
async function Ce(e, t = {}) {
|
|
435
|
+
return t.katex === void 0 && Q(e) ? ($ ??= import("katex").then((e) => e.default ?? e).catch(() => null), Z(e, {
|
|
436
|
+
...t,
|
|
437
|
+
katex: await $
|
|
438
|
+
})) : Z(e, t);
|
|
439
|
+
}
|
|
440
|
+
function we(e) {
|
|
441
|
+
return `<style id="mei-editor-tokens">${[s(), o(e)].filter(Boolean).join("\n").replace(/<\/style/gi, "<\\/style")}</style>`;
|
|
442
|
+
}
|
|
443
|
+
export { A as attr, s as baseTokensCss, k as escapeHtml, Q as hasMath, R as highlightCode, Se as hydrateMermaid, o as overridesCss, Z as renderHTML, Ce as renderHTMLAsync, we as renderTokensStyle, N as safeUrl };
|
|
444
|
+
|
|
445
|
+
//# sourceMappingURL=render.js.map
|