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