@wenyan-md/core 1.0.9 → 1.0.11

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/dist/core.js CHANGED
@@ -1,148 +1,146 @@
1
- import { Marked as H } from "marked";
2
- import { markedHighlight as P } from "marked-highlight";
1
+ import { marked as d } from "marked";
2
+ import { markedHighlight as H } from "marked-highlight";
3
3
  import x from "highlight.js";
4
- import j from "front-matter";
4
+ import P from "front-matter";
5
5
  import * as f from "css-tree";
6
- import { mathjax as V } from "mathjax-full/js/mathjax.js";
7
- import { TeX as q } from "mathjax-full/js/input/tex.js";
8
- import { SVG as I } from "mathjax-full/js/output/svg.js";
9
- import { liteAdaptor as R } from "mathjax-full/js/adaptors/liteAdaptor.js";
6
+ import { mathjax as j } from "mathjax-full/js/mathjax.js";
7
+ import { TeX as V } from "mathjax-full/js/input/tex.js";
8
+ import { SVG as q } from "mathjax-full/js/output/svg.js";
9
+ import { liteAdaptor as I } from "mathjax-full/js/adaptors/liteAdaptor.js";
10
10
  import { RegisterHTMLHandler as S } from "mathjax-full/js/handlers/html.js";
11
- import { AllPackages as z } from "mathjax-full/js/input/tex/AllPackages.js";
11
+ import { AllPackages as R } from "mathjax-full/js/input/tex/AllPackages.js";
12
12
  import { themes as b } from "./theme.js";
13
13
  import { hlThemes as C } from "./hltheme.js";
14
- const N = {
14
+ const z = {
15
15
  inlineMath: [["$", "$"], ["\\(", "\\)"]],
16
16
  displayMath: [["$$", "$$"], ["\\[", "\\]"]],
17
17
  processEscapes: !0,
18
- packages: z
19
- }, D = {
18
+ packages: R
19
+ }, E = {
20
20
  fontCache: "none"
21
21
  };
22
22
  let m;
23
23
  if (!m) {
24
- m = R();
24
+ m = I();
25
25
  try {
26
26
  S(m);
27
27
  } catch {
28
28
  }
29
29
  }
30
30
  S(m);
31
- const E = new q(N), F = new I(D);
32
- function M(r, n) {
33
- const a = r.display ? "section" : "span", e = r.display ? "block-equation" : "inline-equation";
34
- r.typesetRoot = n.adaptor.node(a, { class: e }, [r.typesetRoot]);
31
+ const N = new V(z), D = new q(E);
32
+ function A(t, i) {
33
+ const l = t.display ? "section" : "span", o = t.display ? "block-equation" : "inline-equation";
34
+ t.typesetRoot = i.adaptor.node(l, { class: o }, [t.typesetRoot]);
35
35
  }
36
- async function G(r) {
36
+ async function F(t) {
37
37
  try {
38
- const n = V.document(r, {
39
- InputJax: E,
40
- OutputJax: F,
38
+ const i = j.document(t, {
39
+ InputJax: N,
40
+ OutputJax: D,
41
41
  renderActions: {
42
- addContainer: [190, (e) => {
43
- for (const s of e.math)
44
- M(s, e);
45
- }, M]
42
+ addContainer: [190, (o) => {
43
+ for (const r of o.math)
44
+ A(r, o);
45
+ }, A]
46
46
  }
47
47
  });
48
- n.render();
49
- const a = m.body(n.document);
50
- return m.innerHTML(a);
51
- } catch (n) {
52
- throw console.error("Error rendering MathJax:", n), n;
48
+ i.render();
49
+ const l = m.body(i.document);
50
+ return m.innerHTML(l);
51
+ } catch (i) {
52
+ throw console.error("Error rendering MathJax:", i), i;
53
53
  }
54
54
  }
55
- const B = `#wenyan pre::before {
55
+ const G = `#wenyan pre::before {
56
56
  display: block;
57
57
  content: "";
58
58
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="12" viewBox="0 0 450 130"><ellipse cx="65" cy="65" rx="50" ry="52" stroke="rgb(220,60,54)" stroke-width="2" fill="rgb(237,108,96)"/><ellipse cx="225" cy="65" rx="50" ry="52" stroke="rgb(218,151,33)" stroke-width="2" fill="rgb(247,193,81)"/><ellipse cx="385" cy="65" rx="50" ry="52" stroke="rgb(27,161,37)" stroke-width="2" fill="rgb(100,200,86)"/></svg>');
59
59
  background-repeat: no-repeat;
60
60
  width: 100%;
61
61
  height: 16px;
62
- }`, le = "ui-serif, Georgia, Cambria, 'Noto Serif', 'Times New Roman', serif", J = "ui-sans-serif, system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', 'Roboto', sans-serif", L = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace";
63
- let g;
64
- function ce() {
65
- g = new H(
66
- P({
67
- emptyLangClass: "hljs",
68
- langPrefix: "hljs language-",
69
- highlight: function(e, s, o) {
70
- const l = x.getLanguage(s) ? s : "plaintext";
71
- return x.highlight(e, { language: l }).value;
72
- }
73
- })
74
- );
75
- const r = {
62
+ }`, ie = "ui-serif, Georgia, Cambria, 'Noto Serif', 'Times New Roman', serif", B = "ui-sans-serif, system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', 'Roboto', sans-serif", L = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace";
63
+ function le() {
64
+ const t = H({
65
+ emptyLangClass: "hljs",
66
+ langPrefix: "hljs language-",
67
+ highlight: function(r, n, s) {
68
+ const e = x.getLanguage(n) ? n : "plaintext";
69
+ return x.highlight(r, { language: e }).value;
70
+ }
71
+ });
72
+ d.use(t);
73
+ const i = {
76
74
  name: "attributeImage",
77
75
  level: "inline",
78
- start(e) {
79
- return e.indexOf("![");
76
+ start(r) {
77
+ return r.indexOf("![");
80
78
  },
81
- tokenizer(e) {
82
- const o = /^!\[([^\]]*)\]\(([^)]+)\)\{(.*?)\}/.exec(e);
83
- if (o)
79
+ tokenizer(r) {
80
+ const s = /^!\[([^\]]*)\]\(([^)]+)\)\{(.*?)\}/.exec(r);
81
+ if (s)
84
82
  return {
85
83
  type: "attributeImage",
86
- raw: o[0],
87
- alt: o[1],
88
- href: o[2],
89
- attrs: o[3]
84
+ raw: s[0],
85
+ alt: s[1],
86
+ href: s[2],
87
+ attrs: s[3]
90
88
  };
91
89
  },
92
- renderer(e) {
93
- const s = O(e.attrs), o = Array.from(s).map(
94
- ([l, t]) => /^\d+$/.test(t) ? `${l}:${t}px` : `${l}:${t}`
90
+ renderer(r) {
91
+ const n = J(r.attrs), s = Array.from(n).map(
92
+ ([e, a]) => /^\d+$/.test(a) ? `${e}:${a}px` : `${e}:${a}`
95
93
  ).join("; ");
96
- return `<img src="${e.href}" alt="${e.alt}" style="${o}">`;
94
+ return `<img src="${r.href}" alt="${r.alt || ""}" title="${r.alt || ""}" style="${s}">`;
97
95
  }
98
96
  };
99
- g.use({ extensions: [r] });
100
- const n = g.Renderer, a = g.Parser;
101
- n.heading = function(e) {
102
- const s = a.parseInline(e.tokens), o = e.depth;
103
- return `<h${o}><span>${s}</span></h${o}>
97
+ d.use({ extensions: [i] });
98
+ const l = d.Renderer, o = d.Parser;
99
+ l.heading = function(r) {
100
+ const n = o.parseInline(r.tokens), s = r.depth;
101
+ return `<h${s}><span>${n}</span></h${s}>
104
102
  `;
105
- }, n.paragraph = function(e) {
106
- const s = e.text;
107
- return s.length > 4 && (/\$\$[\s\S]*?\$\$/g.test(s) || /\\\[[\s\S]*?\\\]/g.test(s)) ? `${s}
108
- ` : `<p>${a.parseInline(e.tokens)}</p>
103
+ }, l.paragraph = function(r) {
104
+ const n = r.text;
105
+ return n.length > 4 && (/\$\$[\s\S]*?\$\$/g.test(n) || /\\\[[\s\S]*?\\\]/g.test(n)) ? `${n}
106
+ ` : `<p>${o.parseInline(r.tokens)}</p>
109
107
  `;
110
- }, n.image = function(e, s, o) {
111
- return `<img src="${e.href}" alt="${o || ""}" title="${s || o || ""}">`;
112
- }, g.use({ renderer: n });
108
+ }, l.image = function(r, n, s) {
109
+ return `<img src="${r.href}" alt="${r.text || ""}" title="${r.text || ""}">`;
110
+ }, d.use({ renderer: l });
113
111
  }
114
- function O(r) {
115
- const n = /* @__PURE__ */ new Map();
116
- return r.split(/\s+/).forEach((a) => {
117
- const [e, s] = a.split("=");
118
- e && s && n.set(e, s.replace(/^["']|["']$/g, ""));
119
- }), n;
112
+ function J(t) {
113
+ const i = /* @__PURE__ */ new Map();
114
+ return t.split(/\s+/).forEach((l) => {
115
+ const [o, r] = l.split("=");
116
+ o && r && i.set(o, r.replace(/^["']|["']$/g, ""));
117
+ }), i;
120
118
  }
121
- function pe(r) {
122
- const { attributes: n, body: a } = j(r), e = {};
123
- let s = "";
124
- const { title: o, description: l, cover: t } = n;
125
- return o && (e.title = o), l && (s += "> " + l + `
119
+ function ce(t) {
120
+ const { attributes: i, body: l } = P(t), o = {};
121
+ let r = "";
122
+ const { title: n, description: s, cover: e } = i;
123
+ return n && (o.title = n), s && (r += "> " + s + `
126
124
 
127
- `, e.description = l), t && (e.cover = t), e.body = s + a, e;
125
+ `, o.description = s), e && (o.cover = e), o.body = r + l, o;
128
126
  }
129
- async function fe(r) {
130
- const n = g.parse(r);
131
- return await G(n);
127
+ async function pe(t) {
128
+ const i = d.parse(t);
129
+ return await F(i);
132
130
  }
133
- async function ue(r, n, a, e = !0, s = !0) {
134
- let o = b.default;
135
- if (n && (o = b[n], o || (o = Object.values(b).find(
136
- (c) => c.name.toLowerCase() === n.toLowerCase()
137
- ))), !o)
131
+ async function fe(t, i, l, o = !0, r = !0) {
132
+ let n = b.default;
133
+ if (i && (n = b[i], n || (n = Object.values(b).find(
134
+ (c) => c.name.toLowerCase() === i.toLowerCase()
135
+ ))), !n)
138
136
  throw new Error("主题不存在");
139
- if (!(a in C))
137
+ if (!(l in C))
140
138
  throw new Error("代码块主题不存在");
141
- const l = W(await o.getCss()), i = await C[a].getCss();
142
- return U(r, l, i, e, s);
139
+ const s = U(await n.getCss()), a = await C[l].getCss();
140
+ return O(t, s, a, o, r);
143
141
  }
144
- async function U(r, n, a, e = !0, s = !0) {
145
- s && Z(!1, r), n = Y(n, {
142
+ async function O(t, i, l, o = !0, r = !0) {
143
+ r && Y(!1, t), i = W(i, {
146
144
  "#wenyan pre code": [
147
145
  {
148
146
  property: "font-family",
@@ -158,39 +156,39 @@ async function U(r, n, a, e = !0, s = !0) {
158
156
  }
159
157
  ]
160
158
  });
161
- const o = f.parse(n, {
159
+ const n = f.parse(i, {
162
160
  context: "stylesheet",
163
161
  positions: !1,
164
162
  parseAtrulePrelude: !1,
165
163
  parseCustomProperty: !1,
166
164
  parseValue: !1
167
- }), l = f.parse(a, {
165
+ }), s = f.parse(l, {
168
166
  context: "stylesheet",
169
167
  positions: !1,
170
168
  parseAtrulePrelude: !1,
171
169
  parseCustomProperty: !1,
172
170
  parseValue: !1
173
171
  });
174
- if (o.children.appendList(l.children), e) {
175
- const i = f.parse(B, {
172
+ if (n.children.appendList(s.children), o) {
173
+ const a = f.parse(G, {
176
174
  context: "stylesheet",
177
175
  positions: !1,
178
176
  parseAtrulePrelude: !1,
179
177
  parseCustomProperty: !1,
180
178
  parseValue: !1
181
179
  });
182
- o.children.appendList(i.children);
180
+ n.children.appendList(a.children);
183
181
  }
184
- f.walk(o, {
182
+ f.walk(n, {
185
183
  visit: "Rule",
186
- enter(i, c, p) {
187
- const u = i.prelude.children;
188
- u && u.forEach((d) => {
189
- const h = f.generate(d), $ = i.block.children.toArray();
184
+ enter(a, c, p) {
185
+ const u = a.prelude.children;
186
+ u && u.forEach((g) => {
187
+ const h = f.generate(g), $ = a.block.children.toArray();
190
188
  h === "#wenyan" ? $.forEach((y) => {
191
189
  const v = f.generate(y.value);
192
- r.style[y.property] = v;
193
- }) : r.querySelectorAll(h).forEach((v) => {
190
+ t.style[y.property] = v;
191
+ }) : t.querySelectorAll(h).forEach((v) => {
194
192
  $.forEach((w) => {
195
193
  const T = f.generate(w.value);
196
194
  v.style[w.property] = T;
@@ -199,81 +197,81 @@ async function U(r, n, a, e = !0, s = !0) {
199
197
  });
200
198
  }
201
199
  });
202
- let t = r.querySelectorAll("mjx-container");
203
- return t.forEach((i) => {
204
- const c = i.querySelector("svg");
200
+ let e = t.querySelectorAll("mjx-container");
201
+ return e.forEach((a) => {
202
+ const c = a.querySelector("svg");
205
203
  c.style.width = c.getAttribute("width"), c.style.height = c.getAttribute("height"), c.removeAttribute("width"), c.removeAttribute("height");
206
- const p = i.parentElement;
207
- i.remove(), p.appendChild(c), p.classList.contains("block-equation") && p.setAttribute("style", "text-align: center; margin-bottom: 1rem;");
208
- }), t = r.querySelectorAll("pre code"), t.forEach((i) => {
209
- i.innerHTML = i.innerHTML.replace(/\n/g, "<br>").replace(/(>[^<]+)|(^[^<]+)/g, (c) => c.replace(/\s/g, "&nbsp;"));
210
- }), t = r.querySelectorAll("h1, h2, h3, h4, h5, h6, blockquote, pre"), t.forEach((i) => {
204
+ const p = a.parentElement;
205
+ a.remove(), p.appendChild(c), p.classList.contains("block-equation") && p.setAttribute("style", "text-align: center; margin-bottom: 1rem;");
206
+ }), e = t.querySelectorAll("pre code"), e.forEach((a) => {
207
+ a.innerHTML = a.innerHTML.replace(/\n/g, "<br>").replace(/(>[^<]+)|(^[^<]+)/g, (c) => c.replace(/\s/g, "&nbsp;"));
208
+ }), e = t.querySelectorAll("h1, h2, h3, h4, h5, h6, blockquote, pre"), e.forEach((a) => {
211
209
  const c = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
212
- f.walk(o, {
210
+ f.walk(n, {
213
211
  visit: "Rule",
214
212
  enter(u) {
215
- const d = f.generate(u.prelude), h = i.tagName.toLowerCase();
216
- d.includes(`${h}::after`) ? A(u, c) : d.includes(`${h}::before`) && A(u, p);
213
+ const g = f.generate(u.prelude), h = a.tagName.toLowerCase();
214
+ g.includes(`${h}::after`) ? M(u, c) : g.includes(`${h}::before`) && M(u, p);
217
215
  }
218
- }), c.size > 0 && i.appendChild(k(c, r.ownerDocument)), p.size > 0 && i.insertBefore(k(p, r.ownerDocument), i.firstChild);
219
- }), r.setAttribute("data-provider", "WenYan"), `${r.outerHTML.replace(/class="mjx-solid"/g, 'fill="none" stroke-width="70"')}`;
216
+ }), c.size > 0 && a.appendChild(k(c, t.ownerDocument)), p.size > 0 && a.insertBefore(k(p, t.ownerDocument), a.firstChild);
217
+ }), t.setAttribute("data-provider", "WenYan"), `${t.outerHTML.replace(/class="mjx-solid"/g, 'fill="none" stroke-width="70"')}`;
220
218
  }
221
- function W(r) {
222
- const n = /--([a-zA-Z0-9\-]+):\s*([^;()]*\((?:[^()]*|\([^()]*\))*\)[^;()]*|[^;]+);/g, a = /var\(--([a-zA-Z0-9\-]+)\)/g, e = {};
223
- let s;
224
- for (; (s = n.exec(r)) !== null; ) {
225
- const t = s[1], i = s[2].trim().replaceAll(`
219
+ function U(t) {
220
+ const i = /--([a-zA-Z0-9\-]+):\s*([^;()]*\((?:[^()]*|\([^()]*\))*\)[^;()]*|[^;]+);/g, l = /var\(--([a-zA-Z0-9\-]+)\)/g, o = {};
221
+ let r;
222
+ for (; (r = i.exec(t)) !== null; ) {
223
+ const e = r[1], a = r[2].trim().replaceAll(`
226
224
  `, "");
227
- e[t] = i;
225
+ o[e] = a;
228
226
  }
229
- e["sans-serif-font"] || (e["sans-serif-font"] = J), e["monospace-font"] || (e["monospace-font"] = L);
230
- function o(t, i, c = /* @__PURE__ */ new Set()) {
231
- if (c.has(t)) return t;
232
- c.add(t);
233
- let p = t, u;
234
- for (; (u = a.exec(p)) !== null; ) {
235
- const d = u[1];
236
- if (i[d]) {
237
- const h = o(i[d], i, c);
227
+ o["sans-serif-font"] || (o["sans-serif-font"] = B), o["monospace-font"] || (o["monospace-font"] = L);
228
+ function n(e, a, c = /* @__PURE__ */ new Set()) {
229
+ if (c.has(e)) return e;
230
+ c.add(e);
231
+ let p = e, u;
232
+ for (; (u = l.exec(p)) !== null; ) {
233
+ const g = u[1];
234
+ if (a[g]) {
235
+ const h = n(a[g], a, c);
238
236
  p = p.replace(u[0], h);
239
237
  }
240
238
  }
241
239
  return p;
242
240
  }
243
- for (const t in e) {
244
- const i = o(e[t], e);
245
- e[t] = i;
241
+ for (const e in o) {
242
+ const a = n(o[e], o);
243
+ o[e] = a;
246
244
  }
247
- let l = r;
248
- for (; (s = a.exec(r)) !== null; ) {
249
- const t = s[1];
250
- e[t] && (l = l.replace(s[0], e[t]));
245
+ let s = t;
246
+ for (; (r = l.exec(t)) !== null; ) {
247
+ const e = r[1];
248
+ o[e] && (s = s.replace(r[0], o[e]));
251
249
  }
252
- return l.replace(/:root\s*\{[^}]*\}/g, "");
250
+ return s.replace(/:root\s*\{[^}]*\}/g, "");
253
251
  }
254
- function Y(r, n) {
255
- const a = f.parse(r, {
252
+ function W(t, i) {
253
+ const l = f.parse(t, {
256
254
  context: "stylesheet",
257
255
  positions: !1,
258
256
  parseAtrulePrelude: !1,
259
257
  parseCustomProperty: !1,
260
258
  parseValue: !1
261
259
  });
262
- return f.walk(a, {
260
+ return f.walk(l, {
263
261
  visit: "Rule",
264
- leave: (e, s, o) => {
265
- if (e.prelude.type !== "SelectorList") return;
266
- const l = e.prelude.children.toArray().map((t) => f.generate(t));
267
- if (l) {
268
- const t = l[0], i = n[t];
269
- if (!i) return;
270
- for (const { property: c, value: p, append: u } of i)
262
+ leave: (o, r, n) => {
263
+ if (o.prelude.type !== "SelectorList") return;
264
+ const s = o.prelude.children.toArray().map((e) => f.generate(e));
265
+ if (s) {
266
+ const e = s[0], a = i[e];
267
+ if (!a) return;
268
+ for (const { property: c, value: p, append: u } of a)
271
269
  if (p) {
272
- let d = !1;
273
- f.walk(e.block, (h) => {
274
- h.type === "Declaration" && h.property === c && (h.value = f.parse(p, { context: "value" }), d = !0);
275
- }), !d && u && e.block.children.prepend(
276
- o.createItem({
270
+ let g = !1;
271
+ f.walk(o.block, (h) => {
272
+ h.type === "Declaration" && h.property === c && (h.value = f.parse(p, { context: "value" }), g = !0);
273
+ }), !g && u && o.block.children.prepend(
274
+ n.createItem({
277
275
  type: "Declaration",
278
276
  property: c,
279
277
  value: f.parse(p, { context: "value" })
@@ -282,66 +280,66 @@ function Y(r, n) {
282
280
  }
283
281
  }
284
282
  }
285
- }), f.generate(a);
283
+ }), f.generate(l);
286
284
  }
287
- function A(r, n) {
288
- f.walk(r.block, {
285
+ function M(t, i) {
286
+ f.walk(t.block, {
289
287
  visit: "Declaration",
290
- enter(a) {
291
- const e = a.property, s = f.generate(a.value);
292
- n.set(e, s);
288
+ enter(l) {
289
+ const o = l.property, r = f.generate(l.value);
290
+ i.set(o, r);
293
291
  }
294
292
  });
295
293
  }
296
- function k(r, n) {
297
- const a = n.createElement("section");
298
- r.get("content") && (a.textContent = r.get("content").replace(/['"]/g, ""), r.delete("content"));
299
- for (const [o, l] of r)
300
- if (l.includes("url(")) {
301
- const t = l.match(/data:image\/svg\+xml;utf8,(.*<\/svg>)/), i = l.match(/data:image\/svg\+xml;base64,([^"'\)]*)["']?\)/), c = l.match(/(?:"|')?(https?[^"'\)]*)(?:"|')?\)/);
302
- if (t) {
303
- const p = decodeURIComponent(t[1]);
304
- a.innerHTML = p;
305
- } else if (i) {
306
- const p = atob(i[1]);
307
- a.innerHTML = p;
294
+ function k(t, i) {
295
+ const l = i.createElement("section");
296
+ t.get("content") && (l.textContent = t.get("content").replace(/['"]/g, ""), t.delete("content"));
297
+ for (const [n, s] of t)
298
+ if (s.includes("url(")) {
299
+ const e = s.match(/data:image\/svg\+xml;utf8,(.*<\/svg>)/), a = s.match(/data:image\/svg\+xml;base64,([^"'\)]*)["']?\)/), c = s.match(/(?:"|')?(https?[^"'\)]*)(?:"|')?\)/);
300
+ if (e) {
301
+ const p = decodeURIComponent(e[1]);
302
+ l.innerHTML = p;
303
+ } else if (a) {
304
+ const p = atob(a[1]);
305
+ l.innerHTML = p;
308
306
  } else if (c) {
309
- const p = n.createElement("img");
310
- p.src = c[1], p.setAttribute("style", "vertical-align: top;"), a.appendChild(p);
307
+ const p = i.createElement("img");
308
+ p.src = c[1], p.setAttribute("style", "vertical-align: top;"), l.appendChild(p);
311
309
  }
312
- r.delete(o);
310
+ t.delete(n);
313
311
  }
314
- const s = Array.from(r.entries()).map(([o, l]) => `${o}: ${l}`).join("; ");
315
- return a.style.cssText = s, a;
312
+ const r = Array.from(t.entries()).map(([n, s]) => `${n}: ${s}`).join("; ");
313
+ return l.style.cssText = r, l;
316
314
  }
317
- function Z(r, n) {
318
- let a = [], e = 0;
319
- if (n.querySelectorAll("a[href]").forEach((o) => {
320
- const l = o.textContent || o.innerText, t = o.getAttribute("href");
321
- a.push([++e, l, t]);
322
- const i = n.ownerDocument.createElement("sup");
323
- i.setAttribute("class", "footnote"), i.innerHTML = `[${e}]`, o.after(i);
324
- }), e > 0)
325
- if (r) {
326
- const l = `<h3>引用链接</h3><div id="footnotes"><ul>${a.map((t) => t[1] === t[2] ? `<li id="#footnote-${t[0]}">[${t[0]}]: <i>${t[1]}</i></li>` : `<li id="#footnote-${t[0]}">[${t[0]}] ${t[1]}: <i>${t[2]}</i></li>`).join("")}</ul></div>`;
327
- n.innerHTML += l;
315
+ function Y(t, i) {
316
+ let l = [], o = 0;
317
+ if (i.querySelectorAll("a[href]").forEach((n) => {
318
+ const s = n.textContent || n.innerText, e = n.getAttribute("href");
319
+ l.push([++o, s, e]);
320
+ const a = i.ownerDocument.createElement("sup");
321
+ a.setAttribute("class", "footnote"), a.innerHTML = `[${o}]`, n.after(a);
322
+ }), o > 0)
323
+ if (t) {
324
+ const s = `<h3>引用链接</h3><div id="footnotes"><ul>${l.map((e) => e[1] === e[2] ? `<li id="#footnote-${e[0]}">[${e[0]}]: <i>${e[1]}</i></li>` : `<li id="#footnote-${e[0]}">[${e[0]}] ${e[1]}: <i>${e[2]}</i></li>`).join("")}</ul></div>`;
325
+ i.innerHTML += s;
328
326
  } else {
329
- const l = `<h3>引用链接</h3><section id="footnotes">${a.map((t) => t[1] === t[2] ? `<p><span class="footnote-num">[${t[0]}]</span><span class="footnote-txt"><i>${t[1]}</i></span></p>` : `<p><span class="footnote-num">[${t[0]}]</span><span class="footnote-txt">${t[1]}: <i>${t[2]}</i></span></p>`).join("")}</section>`;
330
- n.innerHTML += l;
327
+ const s = `<h3>引用链接</h3><section id="footnotes">${l.map((e) => e[1] === e[2] ? `<p><span class="footnote-num">[${e[0]}]</span><span class="footnote-txt"><i>${e[1]}</i></span></p>` : `<p><span class="footnote-num">[${e[0]}]</span><span class="footnote-txt">${e[1]}: <i>${e[2]}</i></span></p>`).join("")}</section>`;
328
+ i.innerHTML += s;
331
329
  }
332
330
  }
333
331
  export {
334
- Z as addFootnotes,
332
+ Y as addFootnotes,
335
333
  k as buildPseudoSpan,
336
- ce as configureMarked,
337
- A as extractDeclarations,
338
- ue as getContentForGzhBuiltinTheme,
339
- U as getContentForGzhCustomCss,
340
- pe as handleFrontMatter,
341
- Y as modifyCss,
334
+ le as configureMarked,
335
+ M as extractDeclarations,
336
+ fe as getContentForGzhBuiltinTheme,
337
+ O as getContentForGzhCustomCss,
338
+ ce as handleFrontMatter,
339
+ W as modifyCss,
342
340
  L as monospace,
343
- fe as renderMarkdown,
344
- W as replaceCSSVariables,
345
- J as sansSerif,
346
- le as serif
341
+ pe as renderMarkdown,
342
+ U as replaceCSSVariables,
343
+ B as sansSerif,
344
+ ie as serif
347
345
  };