@wenyan-md/core 1.0.12 → 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 +17 -2
- package/dist/browser/wenyan-core.js +26 -26
- package/dist/core.js +187 -180
- 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
1
|
import { marked as g } from "marked";
|
|
2
|
-
import { markedHighlight as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
|
|
133
|
+
async function ue(t) {
|
|
134
|
+
await U();
|
|
128
135
|
const i = g.parse(t);
|
|
129
|
-
return await
|
|
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 a =
|
|
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,7 +163,7 @@ 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,
|
|
@@ -169,92 +176,92 @@ async function O(t, i, l, o = !0, r = !0) {
|
|
|
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 =
|
|
191
|
+
enter(s, c, p) {
|
|
192
|
+
const u = s.prelude.children;
|
|
186
193
|
u && u.forEach((d) => {
|
|
187
|
-
const h = f.generate(d),
|
|
188
|
-
h === "#wenyan" ?
|
|
189
|
-
const
|
|
190
|
-
t.style[
|
|
191
|
-
}) : t.querySelectorAll(h).forEach((
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
-
|
|
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 d = f.generate(u.prelude), h =
|
|
214
|
-
d.includes(`${h}::after`) ?
|
|
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 &&
|
|
217
|
-
}), e = t.querySelectorAll("li"), e.forEach((
|
|
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) => {
|
|
218
225
|
const c = t.ownerDocument.createElement("section");
|
|
219
|
-
for (;
|
|
220
|
-
c.appendChild(
|
|
221
|
-
|
|
226
|
+
for (; s.firstChild; )
|
|
227
|
+
c.appendChild(s.firstChild);
|
|
228
|
+
s.appendChild(c);
|
|
222
229
|
}), t.setAttribute("data-provider", "WenYan"), `${t.outerHTML.replace(/class="mjx-solid"/g, 'fill="none" stroke-width="70"')}`;
|
|
223
230
|
}
|
|
224
|
-
function
|
|
225
|
-
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 = {};
|
|
226
233
|
let r;
|
|
227
234
|
for (; (r = i.exec(t)) !== null; ) {
|
|
228
|
-
const e = r[1],
|
|
235
|
+
const e = r[1], s = r[2].trim().replaceAll(`
|
|
229
236
|
`, "");
|
|
230
|
-
|
|
237
|
+
n[e] = s;
|
|
231
238
|
}
|
|
232
|
-
|
|
233
|
-
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()) {
|
|
234
241
|
if (c.has(e)) return e;
|
|
235
242
|
c.add(e);
|
|
236
243
|
let p = e, u;
|
|
237
244
|
for (; (u = l.exec(p)) !== null; ) {
|
|
238
245
|
const d = u[1];
|
|
239
|
-
if (
|
|
240
|
-
const h = s
|
|
246
|
+
if (s[d]) {
|
|
247
|
+
const h = o(s[d], s, c);
|
|
241
248
|
p = p.replace(u[0], h);
|
|
242
249
|
}
|
|
243
250
|
}
|
|
244
251
|
return p;
|
|
245
252
|
}
|
|
246
|
-
for (const e in
|
|
247
|
-
const
|
|
248
|
-
|
|
253
|
+
for (const e in n) {
|
|
254
|
+
const s = o(n[e], n);
|
|
255
|
+
n[e] = s;
|
|
249
256
|
}
|
|
250
257
|
let a = t;
|
|
251
258
|
for (; (r = l.exec(t)) !== null; ) {
|
|
252
259
|
const e = r[1];
|
|
253
|
-
|
|
260
|
+
n[e] && (a = a.replace(r[0], n[e]));
|
|
254
261
|
}
|
|
255
262
|
return a.replace(/:root\s*\{[^}]*\}/g, "");
|
|
256
263
|
}
|
|
257
|
-
function
|
|
264
|
+
function X(t, i) {
|
|
258
265
|
const l = f.parse(t, {
|
|
259
266
|
context: "stylesheet",
|
|
260
267
|
positions: !1,
|
|
@@ -264,19 +271,19 @@ function W(t, i) {
|
|
|
264
271
|
});
|
|
265
272
|
return f.walk(l, {
|
|
266
273
|
visit: "Rule",
|
|
267
|
-
leave: (
|
|
268
|
-
if (
|
|
269
|
-
const a =
|
|
274
|
+
leave: (n, r, o) => {
|
|
275
|
+
if (n.prelude.type !== "SelectorList") return;
|
|
276
|
+
const a = n.prelude.children.toArray().map((e) => f.generate(e));
|
|
270
277
|
if (a) {
|
|
271
|
-
const e = a[0],
|
|
272
|
-
if (!
|
|
273
|
-
for (const { property: c, value: p, append: u } of
|
|
278
|
+
const e = a[0], s = i[e];
|
|
279
|
+
if (!s) return;
|
|
280
|
+
for (const { property: c, value: p, append: u } of s)
|
|
274
281
|
if (p) {
|
|
275
282
|
let d = !1;
|
|
276
|
-
f.walk(
|
|
283
|
+
f.walk(n.block, (h) => {
|
|
277
284
|
h.type === "Declaration" && h.property === c && (h.value = f.parse(p, { context: "value" }), d = !0);
|
|
278
|
-
}), !d && u &&
|
|
279
|
-
|
|
285
|
+
}), !d && u && n.block.children.prepend(
|
|
286
|
+
o.createItem({
|
|
280
287
|
type: "Declaration",
|
|
281
288
|
property: c,
|
|
282
289
|
value: f.parse(p, { context: "value" })
|
|
@@ -287,44 +294,44 @@ function W(t, i) {
|
|
|
287
294
|
}
|
|
288
295
|
}), f.generate(l);
|
|
289
296
|
}
|
|
290
|
-
function
|
|
297
|
+
function S(t, i) {
|
|
291
298
|
f.walk(t.block, {
|
|
292
299
|
visit: "Declaration",
|
|
293
300
|
enter(l) {
|
|
294
|
-
const
|
|
295
|
-
i.set(
|
|
301
|
+
const n = l.property, r = f.generate(l.value);
|
|
302
|
+
i.set(n, r);
|
|
296
303
|
}
|
|
297
304
|
});
|
|
298
305
|
}
|
|
299
|
-
function
|
|
306
|
+
function L(t, i) {
|
|
300
307
|
const l = i.createElement("section");
|
|
301
308
|
t.get("content") && (l.textContent = t.get("content").replace(/['"]/g, ""), t.delete("content"));
|
|
302
|
-
for (const [
|
|
309
|
+
for (const [o, a] of t)
|
|
303
310
|
if (a.includes("url(")) {
|
|
304
|
-
const e = a.match(/data:image\/svg\+xml;utf8,(.*<\/svg>)/),
|
|
311
|
+
const e = a.match(/data:image\/svg\+xml;utf8,(.*<\/svg>)/), s = a.match(/data:image\/svg\+xml;base64,([^"'\)]*)["']?\)/), c = a.match(/(?:"|')?(https?[^"'\)]*)(?:"|')?\)/);
|
|
305
312
|
if (e) {
|
|
306
313
|
const p = decodeURIComponent(e[1]);
|
|
307
314
|
l.innerHTML = p;
|
|
308
|
-
} else if (
|
|
309
|
-
const p = atob(
|
|
315
|
+
} else if (s) {
|
|
316
|
+
const p = atob(s[1]);
|
|
310
317
|
l.innerHTML = p;
|
|
311
318
|
} else if (c) {
|
|
312
319
|
const p = i.createElement("img");
|
|
313
320
|
p.src = c[1], p.setAttribute("style", "vertical-align: top;"), l.appendChild(p);
|
|
314
321
|
}
|
|
315
|
-
t.delete(
|
|
322
|
+
t.delete(o);
|
|
316
323
|
}
|
|
317
|
-
const r = Array.from(t.entries()).map(([
|
|
324
|
+
const r = Array.from(t.entries()).map(([o, a]) => `${o}: ${a}`).join("; ");
|
|
318
325
|
return l.style.cssText = r, l;
|
|
319
326
|
}
|
|
320
|
-
function
|
|
321
|
-
let l = [],
|
|
322
|
-
if (i.querySelectorAll("a[href]").forEach((
|
|
323
|
-
const a =
|
|
324
|
-
l.push([++
|
|
325
|
-
const
|
|
326
|
-
|
|
327
|
-
}),
|
|
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)
|
|
328
335
|
if (t) {
|
|
329
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>`;
|
|
330
337
|
i.innerHTML += a;
|
|
@@ -334,17 +341,17 @@ function Y(t, i) {
|
|
|
334
341
|
}
|
|
335
342
|
}
|
|
336
343
|
export {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
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
|
|
350
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
|
}
|