@wenyan-md/core 1.0.8 → 1.0.10
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/browser/wenyan-core.js +31 -31
- package/dist/core.js +184 -183
- package/dist/{phycat-BGGT9oBk.js → phycat-C5ES4IMt.js} +53 -46
- package/dist/publish.js +114 -103
- package/dist/styles/wenyan-styles.js +56 -49
- package/dist/theme.js +1 -1
- package/dist/types/wechatApi.d.ts +8 -0
- package/dist/types/wrapper.d.ts +1 -1
- package/dist/wrapper.js +3 -3
- package/package.json +3 -2
package/dist/core.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { marked as
|
|
1
|
+
import { marked as d } from "marked";
|
|
2
2
|
import { markedHighlight as H } from "marked-highlight";
|
|
3
3
|
import x from "highlight.js";
|
|
4
4
|
import P from "front-matter";
|
|
5
5
|
import * as f from "css-tree";
|
|
6
|
-
import { mathjax as
|
|
7
|
-
import { TeX as
|
|
6
|
+
import { mathjax as j } from "mathjax-full/js/mathjax.js";
|
|
7
|
+
import { TeX as V } from "mathjax-full/js/input/tex.js";
|
|
8
8
|
import { SVG as q } from "mathjax-full/js/output/svg.js";
|
|
9
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";
|
|
@@ -16,40 +16,40 @@ const z = {
|
|
|
16
16
|
displayMath: [["$$", "$$"], ["\\[", "\\]"]],
|
|
17
17
|
processEscapes: !0,
|
|
18
18
|
packages: R
|
|
19
|
-
},
|
|
19
|
+
}, E = {
|
|
20
20
|
fontCache: "none"
|
|
21
21
|
};
|
|
22
|
-
let
|
|
23
|
-
if (!
|
|
24
|
-
|
|
22
|
+
let m;
|
|
23
|
+
if (!m) {
|
|
24
|
+
m = I();
|
|
25
25
|
try {
|
|
26
|
-
S(
|
|
26
|
+
S(m);
|
|
27
27
|
} catch {
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
S(
|
|
31
|
-
const
|
|
32
|
-
function A(
|
|
33
|
-
const
|
|
34
|
-
|
|
30
|
+
S(m);
|
|
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 F(
|
|
36
|
+
async function F(t) {
|
|
37
37
|
try {
|
|
38
|
-
const
|
|
39
|
-
InputJax:
|
|
40
|
-
OutputJax:
|
|
38
|
+
const i = j.document(t, {
|
|
39
|
+
InputJax: N,
|
|
40
|
+
OutputJax: D,
|
|
41
41
|
renderActions: {
|
|
42
|
-
addContainer: [190, (
|
|
43
|
-
for (const
|
|
44
|
-
A(
|
|
42
|
+
addContainer: [190, (o) => {
|
|
43
|
+
for (const r of o.math)
|
|
44
|
+
A(r, o);
|
|
45
45
|
}, A]
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
return
|
|
51
|
-
} catch (
|
|
52
|
-
throw console.error("Error rendering MathJax:",
|
|
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
55
|
const G = `#wenyan pre::before {
|
|
@@ -61,85 +61,86 @@ const G = `#wenyan pre::before {
|
|
|
61
61
|
height: 16px;
|
|
62
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
63
|
function le() {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
|
|
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 = {
|
|
73
74
|
name: "attributeImage",
|
|
74
75
|
level: "inline",
|
|
75
|
-
start(
|
|
76
|
-
return
|
|
76
|
+
start(r) {
|
|
77
|
+
return r.indexOf("![");
|
|
77
78
|
},
|
|
78
|
-
tokenizer(
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
79
|
+
tokenizer(r) {
|
|
80
|
+
const s = /^!\[([^\]]*)\]\(([^)]+)\)\{(.*?)\}/.exec(r);
|
|
81
|
+
if (s)
|
|
81
82
|
return {
|
|
82
83
|
type: "attributeImage",
|
|
83
|
-
raw:
|
|
84
|
-
alt:
|
|
85
|
-
href:
|
|
86
|
-
attrs:
|
|
84
|
+
raw: s[0],
|
|
85
|
+
alt: s[1],
|
|
86
|
+
href: s[2],
|
|
87
|
+
attrs: s[3]
|
|
87
88
|
};
|
|
88
89
|
},
|
|
89
|
-
renderer(
|
|
90
|
-
const
|
|
91
|
-
([
|
|
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}`
|
|
92
93
|
).join("; ");
|
|
93
|
-
return `<img src="${
|
|
94
|
+
return `<img src="${r.href}" alt="${r.alt || ""}" title="${r.alt || ""}" style="${s}">`;
|
|
94
95
|
}
|
|
95
96
|
};
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
return `<h${
|
|
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}>
|
|
101
102
|
`;
|
|
102
|
-
},
|
|
103
|
-
const
|
|
104
|
-
return
|
|
105
|
-
` : `<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>
|
|
106
107
|
`;
|
|
107
|
-
},
|
|
108
|
-
return `<img src="${
|
|
109
|
-
},
|
|
108
|
+
}, l.image = function(r, n, s) {
|
|
109
|
+
return `<img src="${r.href}" alt="${r.text || ""}" title="${r.text || ""}">`;
|
|
110
|
+
}, d.use({ renderer: l });
|
|
110
111
|
}
|
|
111
|
-
function J(
|
|
112
|
-
const
|
|
113
|
-
return
|
|
114
|
-
const [
|
|
115
|
-
|
|
116
|
-
}),
|
|
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;
|
|
117
118
|
}
|
|
118
|
-
function ce(
|
|
119
|
-
const { attributes:
|
|
120
|
-
let
|
|
121
|
-
const { title:
|
|
122
|
-
return
|
|
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 + `
|
|
123
124
|
|
|
124
|
-
`,
|
|
125
|
+
`, o.description = s), e && (o.cover = e), o.body = r + l, o;
|
|
125
126
|
}
|
|
126
|
-
async function pe(
|
|
127
|
-
const
|
|
128
|
-
return await F(
|
|
127
|
+
async function pe(t) {
|
|
128
|
+
const i = d.parse(t);
|
|
129
|
+
return await F(i);
|
|
129
130
|
}
|
|
130
|
-
async function fe(
|
|
131
|
-
let
|
|
132
|
-
if (
|
|
133
|
-
(c) => c.name.toLowerCase() ===
|
|
134
|
-
))), !
|
|
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)
|
|
135
136
|
throw new Error("主题不存在");
|
|
136
|
-
if (!(
|
|
137
|
+
if (!(l in C))
|
|
137
138
|
throw new Error("代码块主题不存在");
|
|
138
|
-
const
|
|
139
|
-
return O(
|
|
139
|
+
const s = U(await n.getCss()), a = await C[l].getCss();
|
|
140
|
+
return O(t, s, a, o, r);
|
|
140
141
|
}
|
|
141
|
-
async function O(
|
|
142
|
-
|
|
142
|
+
async function O(t, i, l, o = !0, r = !0) {
|
|
143
|
+
r && Y(!1, t), i = W(i, {
|
|
143
144
|
"#wenyan pre code": [
|
|
144
145
|
{
|
|
145
146
|
property: "font-family",
|
|
@@ -155,39 +156,39 @@ async function O(r, n, a, e, s) {
|
|
|
155
156
|
}
|
|
156
157
|
]
|
|
157
158
|
});
|
|
158
|
-
const
|
|
159
|
+
const n = f.parse(i, {
|
|
159
160
|
context: "stylesheet",
|
|
160
161
|
positions: !1,
|
|
161
162
|
parseAtrulePrelude: !1,
|
|
162
163
|
parseCustomProperty: !1,
|
|
163
164
|
parseValue: !1
|
|
164
|
-
}),
|
|
165
|
+
}), s = f.parse(l, {
|
|
165
166
|
context: "stylesheet",
|
|
166
167
|
positions: !1,
|
|
167
168
|
parseAtrulePrelude: !1,
|
|
168
169
|
parseCustomProperty: !1,
|
|
169
170
|
parseValue: !1
|
|
170
171
|
});
|
|
171
|
-
if (
|
|
172
|
-
const
|
|
172
|
+
if (n.children.appendList(s.children), o) {
|
|
173
|
+
const a = f.parse(G, {
|
|
173
174
|
context: "stylesheet",
|
|
174
175
|
positions: !1,
|
|
175
176
|
parseAtrulePrelude: !1,
|
|
176
177
|
parseCustomProperty: !1,
|
|
177
178
|
parseValue: !1
|
|
178
179
|
});
|
|
179
|
-
|
|
180
|
+
n.children.appendList(a.children);
|
|
180
181
|
}
|
|
181
|
-
f.walk(
|
|
182
|
+
f.walk(n, {
|
|
182
183
|
visit: "Rule",
|
|
183
|
-
enter(
|
|
184
|
-
const u =
|
|
185
|
-
u && u.forEach((
|
|
186
|
-
const h = f.generate(
|
|
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();
|
|
187
188
|
h === "#wenyan" ? $.forEach((y) => {
|
|
188
189
|
const v = f.generate(y.value);
|
|
189
|
-
|
|
190
|
-
}) :
|
|
190
|
+
t.style[y.property] = v;
|
|
191
|
+
}) : t.querySelectorAll(h).forEach((v) => {
|
|
191
192
|
$.forEach((w) => {
|
|
192
193
|
const T = f.generate(w.value);
|
|
193
194
|
v.style[w.property] = T;
|
|
@@ -196,81 +197,81 @@ async function O(r, n, a, e, s) {
|
|
|
196
197
|
});
|
|
197
198
|
}
|
|
198
199
|
});
|
|
199
|
-
let
|
|
200
|
-
return
|
|
201
|
-
const c =
|
|
200
|
+
let e = t.querySelectorAll("mjx-container");
|
|
201
|
+
return e.forEach((a) => {
|
|
202
|
+
const c = a.querySelector("svg");
|
|
202
203
|
c.style.width = c.getAttribute("width"), c.style.height = c.getAttribute("height"), c.removeAttribute("width"), c.removeAttribute("height");
|
|
203
|
-
const p =
|
|
204
|
-
|
|
205
|
-
}),
|
|
206
|
-
|
|
207
|
-
}),
|
|
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, " "));
|
|
208
|
+
}), e = t.querySelectorAll("h1, h2, h3, h4, h5, h6, blockquote, pre"), e.forEach((a) => {
|
|
208
209
|
const c = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
209
|
-
f.walk(
|
|
210
|
+
f.walk(n, {
|
|
210
211
|
visit: "Rule",
|
|
211
212
|
enter(u) {
|
|
212
|
-
const
|
|
213
|
-
|
|
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);
|
|
214
215
|
}
|
|
215
|
-
}), c.size > 0 &&
|
|
216
|
-
}),
|
|
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"')}`;
|
|
217
218
|
}
|
|
218
|
-
function U(
|
|
219
|
-
const
|
|
220
|
-
let
|
|
221
|
-
for (; (
|
|
222
|
-
const
|
|
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(`
|
|
223
224
|
`, "");
|
|
224
|
-
e
|
|
225
|
+
o[e] = a;
|
|
225
226
|
}
|
|
226
|
-
|
|
227
|
-
function
|
|
228
|
-
if (c.has(
|
|
229
|
-
c.add(
|
|
230
|
-
let p =
|
|
231
|
-
for (; (u =
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
234
|
-
const h =
|
|
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);
|
|
235
236
|
p = p.replace(u[0], h);
|
|
236
237
|
}
|
|
237
238
|
}
|
|
238
239
|
return p;
|
|
239
240
|
}
|
|
240
|
-
for (const
|
|
241
|
-
const
|
|
242
|
-
e
|
|
241
|
+
for (const e in o) {
|
|
242
|
+
const a = n(o[e], o);
|
|
243
|
+
o[e] = a;
|
|
243
244
|
}
|
|
244
|
-
let
|
|
245
|
-
for (; (
|
|
246
|
-
const
|
|
247
|
-
e
|
|
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]));
|
|
248
249
|
}
|
|
249
|
-
return
|
|
250
|
+
return s.replace(/:root\s*\{[^}]*\}/g, "");
|
|
250
251
|
}
|
|
251
|
-
function W(
|
|
252
|
-
const
|
|
252
|
+
function W(t, i) {
|
|
253
|
+
const l = f.parse(t, {
|
|
253
254
|
context: "stylesheet",
|
|
254
255
|
positions: !1,
|
|
255
256
|
parseAtrulePrelude: !1,
|
|
256
257
|
parseCustomProperty: !1,
|
|
257
258
|
parseValue: !1
|
|
258
259
|
});
|
|
259
|
-
return f.walk(
|
|
260
|
+
return f.walk(l, {
|
|
260
261
|
visit: "Rule",
|
|
261
|
-
leave: (
|
|
262
|
-
if (
|
|
263
|
-
const
|
|
264
|
-
if (
|
|
265
|
-
const
|
|
266
|
-
if (!
|
|
267
|
-
for (const { property: c, value: p, append: u } of
|
|
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)
|
|
268
269
|
if (p) {
|
|
269
|
-
let
|
|
270
|
-
f.walk(
|
|
271
|
-
h.type === "Declaration" && h.property === c && (h.value = f.parse(p, { context: "value" }),
|
|
272
|
-
}), !
|
|
273
|
-
|
|
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({
|
|
274
275
|
type: "Declaration",
|
|
275
276
|
property: c,
|
|
276
277
|
value: f.parse(p, { context: "value" })
|
|
@@ -279,52 +280,52 @@ function W(r, n) {
|
|
|
279
280
|
}
|
|
280
281
|
}
|
|
281
282
|
}
|
|
282
|
-
}), f.generate(
|
|
283
|
+
}), f.generate(l);
|
|
283
284
|
}
|
|
284
|
-
function M(
|
|
285
|
-
f.walk(
|
|
285
|
+
function M(t, i) {
|
|
286
|
+
f.walk(t.block, {
|
|
286
287
|
visit: "Declaration",
|
|
287
|
-
enter(
|
|
288
|
-
const
|
|
289
|
-
|
|
288
|
+
enter(l) {
|
|
289
|
+
const o = l.property, r = f.generate(l.value);
|
|
290
|
+
i.set(o, r);
|
|
290
291
|
}
|
|
291
292
|
});
|
|
292
293
|
}
|
|
293
|
-
function k(
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
for (const [
|
|
297
|
-
if (
|
|
298
|
-
const
|
|
299
|
-
if (
|
|
300
|
-
const p = decodeURIComponent(
|
|
301
|
-
|
|
302
|
-
} else if (
|
|
303
|
-
const p = atob(
|
|
304
|
-
|
|
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;
|
|
305
306
|
} else if (c) {
|
|
306
|
-
const p =
|
|
307
|
-
p.src = c[1], p.setAttribute("style", "vertical-align: top;"),
|
|
307
|
+
const p = i.createElement("img");
|
|
308
|
+
p.src = c[1], p.setAttribute("style", "vertical-align: top;"), l.appendChild(p);
|
|
308
309
|
}
|
|
309
|
-
|
|
310
|
+
t.delete(n);
|
|
310
311
|
}
|
|
311
|
-
const
|
|
312
|
-
return
|
|
312
|
+
const r = Array.from(t.entries()).map(([n, s]) => `${n}: ${s}`).join("; ");
|
|
313
|
+
return l.style.cssText = r, l;
|
|
313
314
|
}
|
|
314
|
-
function Y(
|
|
315
|
-
let
|
|
316
|
-
if (
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
}),
|
|
322
|
-
if (
|
|
323
|
-
const
|
|
324
|
-
|
|
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;
|
|
325
326
|
} else {
|
|
326
|
-
const
|
|
327
|
-
|
|
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;
|
|
328
329
|
}
|
|
329
330
|
}
|
|
330
331
|
export {
|