@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/browser/wenyan-core.js +42 -42
- package/dist/core.js +202 -204
- package/dist/publish.js +130 -118
- package/dist/types/wechatApi.d.ts +8 -0
- package/package.json +3 -2
package/dist/core.js
CHANGED
|
@@ -1,148 +1,146 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { markedHighlight as
|
|
1
|
+
import { marked as d } from "marked";
|
|
2
|
+
import { markedHighlight as H } from "marked-highlight";
|
|
3
3
|
import x from "highlight.js";
|
|
4
|
-
import
|
|
4
|
+
import P from "front-matter";
|
|
5
5
|
import * as f from "css-tree";
|
|
6
|
-
import { mathjax as
|
|
7
|
-
import { TeX as
|
|
8
|
-
import { SVG as
|
|
9
|
-
import { liteAdaptor 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
|
+
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
|
|
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
|
|
14
|
+
const z = {
|
|
15
15
|
inlineMath: [["$", "$"], ["\\(", "\\)"]],
|
|
16
16
|
displayMath: [["$$", "$$"], ["\\[", "\\]"]],
|
|
17
17
|
processEscapes: !0,
|
|
18
|
-
packages:
|
|
19
|
-
},
|
|
18
|
+
packages: R
|
|
19
|
+
}, E = {
|
|
20
20
|
fontCache: "none"
|
|
21
21
|
};
|
|
22
22
|
let m;
|
|
23
23
|
if (!m) {
|
|
24
|
-
m =
|
|
24
|
+
m = I();
|
|
25
25
|
try {
|
|
26
26
|
S(m);
|
|
27
27
|
} catch {
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
S(m);
|
|
31
|
-
const
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
|
|
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
|
|
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
|
-
|
|
45
|
-
},
|
|
42
|
+
addContainer: [190, (o) => {
|
|
43
|
+
for (const r of o.math)
|
|
44
|
+
A(r, o);
|
|
45
|
+
}, A]
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
return m.innerHTML(
|
|
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
|
-
const
|
|
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
|
-
}`,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
highlight:
|
|
70
|
-
|
|
71
|
-
|
|
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(
|
|
79
|
-
return
|
|
76
|
+
start(r) {
|
|
77
|
+
return r.indexOf("![");
|
|
80
78
|
},
|
|
81
|
-
tokenizer(
|
|
82
|
-
const
|
|
83
|
-
if (
|
|
79
|
+
tokenizer(r) {
|
|
80
|
+
const s = /^!\[([^\]]*)\]\(([^)]+)\)\{(.*?)\}/.exec(r);
|
|
81
|
+
if (s)
|
|
84
82
|
return {
|
|
85
83
|
type: "attributeImage",
|
|
86
|
-
raw:
|
|
87
|
-
alt:
|
|
88
|
-
href:
|
|
89
|
-
attrs:
|
|
84
|
+
raw: s[0],
|
|
85
|
+
alt: s[1],
|
|
86
|
+
href: s[2],
|
|
87
|
+
attrs: s[3]
|
|
90
88
|
};
|
|
91
89
|
},
|
|
92
|
-
renderer(
|
|
93
|
-
const
|
|
94
|
-
([
|
|
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="${
|
|
94
|
+
return `<img src="${r.href}" alt="${r.alt || ""}" title="${r.alt || ""}" style="${s}">`;
|
|
97
95
|
}
|
|
98
96
|
};
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
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}>
|
|
104
102
|
`;
|
|
105
|
-
},
|
|
106
|
-
const
|
|
107
|
-
return
|
|
108
|
-
` : `<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
|
-
},
|
|
111
|
-
return `<img src="${
|
|
112
|
-
},
|
|
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
|
|
115
|
-
const
|
|
116
|
-
return
|
|
117
|
-
const [
|
|
118
|
-
|
|
119
|
-
}),
|
|
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
|
|
122
|
-
const { attributes:
|
|
123
|
-
let
|
|
124
|
-
const { title:
|
|
125
|
-
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 + `
|
|
126
124
|
|
|
127
|
-
`,
|
|
125
|
+
`, o.description = s), e && (o.cover = e), o.body = r + l, o;
|
|
128
126
|
}
|
|
129
|
-
async function
|
|
130
|
-
const
|
|
131
|
-
return await
|
|
127
|
+
async function pe(t) {
|
|
128
|
+
const i = d.parse(t);
|
|
129
|
+
return await F(i);
|
|
132
130
|
}
|
|
133
|
-
async function
|
|
134
|
-
let
|
|
135
|
-
if (
|
|
136
|
-
(c) => c.name.toLowerCase() ===
|
|
137
|
-
))), !
|
|
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 (!(
|
|
137
|
+
if (!(l in C))
|
|
140
138
|
throw new Error("代码块主题不存在");
|
|
141
|
-
const
|
|
142
|
-
return
|
|
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
|
|
145
|
-
|
|
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
|
|
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
|
-
}),
|
|
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 (
|
|
175
|
-
const
|
|
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
|
-
|
|
180
|
+
n.children.appendList(a.children);
|
|
183
181
|
}
|
|
184
|
-
f.walk(
|
|
182
|
+
f.walk(n, {
|
|
185
183
|
visit: "Rule",
|
|
186
|
-
enter(
|
|
187
|
-
const u =
|
|
188
|
-
u && u.forEach((
|
|
189
|
-
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();
|
|
190
188
|
h === "#wenyan" ? $.forEach((y) => {
|
|
191
189
|
const v = f.generate(y.value);
|
|
192
|
-
|
|
193
|
-
}) :
|
|
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
|
|
203
|
-
return
|
|
204
|
-
const c =
|
|
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 =
|
|
207
|
-
|
|
208
|
-
}),
|
|
209
|
-
|
|
210
|
-
}),
|
|
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) => {
|
|
211
209
|
const c = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
212
|
-
f.walk(
|
|
210
|
+
f.walk(n, {
|
|
213
211
|
visit: "Rule",
|
|
214
212
|
enter(u) {
|
|
215
|
-
const
|
|
216
|
-
|
|
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 &&
|
|
219
|
-
}),
|
|
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
|
|
222
|
-
const
|
|
223
|
-
let
|
|
224
|
-
for (; (
|
|
225
|
-
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(`
|
|
226
224
|
`, "");
|
|
227
|
-
e
|
|
225
|
+
o[e] = a;
|
|
228
226
|
}
|
|
229
|
-
|
|
230
|
-
function
|
|
231
|
-
if (c.has(
|
|
232
|
-
c.add(
|
|
233
|
-
let p =
|
|
234
|
-
for (; (u =
|
|
235
|
-
const
|
|
236
|
-
if (
|
|
237
|
-
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);
|
|
238
236
|
p = p.replace(u[0], h);
|
|
239
237
|
}
|
|
240
238
|
}
|
|
241
239
|
return p;
|
|
242
240
|
}
|
|
243
|
-
for (const
|
|
244
|
-
const
|
|
245
|
-
e
|
|
241
|
+
for (const e in o) {
|
|
242
|
+
const a = n(o[e], o);
|
|
243
|
+
o[e] = a;
|
|
246
244
|
}
|
|
247
|
-
let
|
|
248
|
-
for (; (
|
|
249
|
-
const
|
|
250
|
-
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]));
|
|
251
249
|
}
|
|
252
|
-
return
|
|
250
|
+
return s.replace(/:root\s*\{[^}]*\}/g, "");
|
|
253
251
|
}
|
|
254
|
-
function
|
|
255
|
-
const
|
|
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(
|
|
260
|
+
return f.walk(l, {
|
|
263
261
|
visit: "Rule",
|
|
264
|
-
leave: (
|
|
265
|
-
if (
|
|
266
|
-
const
|
|
267
|
-
if (
|
|
268
|
-
const
|
|
269
|
-
if (!
|
|
270
|
-
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)
|
|
271
269
|
if (p) {
|
|
272
|
-
let
|
|
273
|
-
f.walk(
|
|
274
|
-
h.type === "Declaration" && h.property === c && (h.value = f.parse(p, { context: "value" }),
|
|
275
|
-
}), !
|
|
276
|
-
|
|
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(
|
|
283
|
+
}), f.generate(l);
|
|
286
284
|
}
|
|
287
|
-
function
|
|
288
|
-
f.walk(
|
|
285
|
+
function M(t, i) {
|
|
286
|
+
f.walk(t.block, {
|
|
289
287
|
visit: "Declaration",
|
|
290
|
-
enter(
|
|
291
|
-
const
|
|
292
|
-
|
|
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(
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
for (const [
|
|
300
|
-
if (
|
|
301
|
-
const
|
|
302
|
-
if (
|
|
303
|
-
const p = decodeURIComponent(
|
|
304
|
-
|
|
305
|
-
} else if (
|
|
306
|
-
const p = atob(
|
|
307
|
-
|
|
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 =
|
|
310
|
-
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);
|
|
311
309
|
}
|
|
312
|
-
|
|
310
|
+
t.delete(n);
|
|
313
311
|
}
|
|
314
|
-
const
|
|
315
|
-
return
|
|
312
|
+
const r = Array.from(t.entries()).map(([n, s]) => `${n}: ${s}`).join("; ");
|
|
313
|
+
return l.style.cssText = r, l;
|
|
316
314
|
}
|
|
317
|
-
function
|
|
318
|
-
let
|
|
319
|
-
if (
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
}),
|
|
325
|
-
if (
|
|
326
|
-
const
|
|
327
|
-
|
|
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
|
|
330
|
-
|
|
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
|
-
|
|
332
|
+
Y as addFootnotes,
|
|
335
333
|
k as buildPseudoSpan,
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
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
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
341
|
+
pe as renderMarkdown,
|
|
342
|
+
U as replaceCSSVariables,
|
|
343
|
+
B as sansSerif,
|
|
344
|
+
ie as serif
|
|
347
345
|
};
|