ezal-theme-example 0.0.4 → 0.0.6
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/assets/scripts/article.ts +11 -1
- package/assets/scripts/home.ts +11 -53
- package/assets/styles/_article/other.styl +8 -0
- package/assets/styles/article.styl +7 -0
- package/assets/styles/home.styl +14 -0
- package/dist/config.d.ts +2 -0
- package/dist/index.js +81 -64
- package/dist/index.js.map +1 -1
- package/dist/markdown/mermaid.d.ts +6 -0
- package/layouts/article.tsx +15 -1
- package/layouts/components/Head.tsx +30 -0
- package/package.json +4 -4
|
@@ -6,7 +6,16 @@ import {
|
|
|
6
6
|
initToc,
|
|
7
7
|
} from './_article';
|
|
8
8
|
import { initBase } from './_base';
|
|
9
|
-
import { doc, handle } from './_utils';
|
|
9
|
+
import { $, doc, handle } from './_utils';
|
|
10
|
+
|
|
11
|
+
function initOutdate() {
|
|
12
|
+
const outdate = $<HTMLElement>('.article-outdate');
|
|
13
|
+
if (!outdate) return;
|
|
14
|
+
if (!outdate.dataset.time) return;
|
|
15
|
+
const time = new Date(outdate.dataset.time).getTime();
|
|
16
|
+
if (Date.now() < time) return;
|
|
17
|
+
outdate.classList.add('article-outdate-show');
|
|
18
|
+
}
|
|
10
19
|
|
|
11
20
|
handle(doc, 'DOMContentLoaded', () => {
|
|
12
21
|
initBase();
|
|
@@ -15,4 +24,5 @@ handle(doc, 'DOMContentLoaded', () => {
|
|
|
15
24
|
initCodeblock();
|
|
16
25
|
initFootnote();
|
|
17
26
|
initImage();
|
|
27
|
+
initOutdate();
|
|
18
28
|
});
|
package/assets/scripts/home.ts
CHANGED
|
@@ -1,73 +1,31 @@
|
|
|
1
1
|
import { initBase } from './_base';
|
|
2
|
-
import { $,
|
|
2
|
+
import { $, doc, handle } from './_utils';
|
|
3
3
|
|
|
4
|
-
let dx = 0;
|
|
5
|
-
let dy = 0;
|
|
6
|
-
let tx = 0;
|
|
7
|
-
let ty = 0;
|
|
8
4
|
let logo: HTMLElement;
|
|
9
|
-
let
|
|
10
|
-
let tick = 0;
|
|
11
|
-
|
|
12
|
-
const nodes = () => $$('use', logo.parentNode!);
|
|
5
|
+
let nodes: SVGUseElement[];
|
|
13
6
|
|
|
14
7
|
const USE = () => {
|
|
15
8
|
const node = doc.createElementNS('http://www.w3.org/2000/svg', 'use');
|
|
16
9
|
node.setAttribute('href', '#logo');
|
|
17
|
-
(node as any).c = tick;
|
|
18
10
|
return node;
|
|
19
11
|
};
|
|
20
12
|
|
|
21
|
-
function next() {
|
|
22
|
-
const node = USE();
|
|
23
|
-
logo.after(node);
|
|
24
|
-
const animation = node.animate(
|
|
25
|
-
[{}, { translate: '128px 128px', opacity: '0' }],
|
|
26
|
-
{ duration: 5000 },
|
|
27
|
-
);
|
|
28
|
-
(node as any).a = animation;
|
|
29
|
-
animation.play();
|
|
30
|
-
animation.onfinish = () => node.remove();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function animate() {
|
|
34
|
-
if (dx < tx) dx = Math.min(dx + 0.1, tx);
|
|
35
|
-
else if (dx > tx) dx = Math.max(dx - 0.1, tx);
|
|
36
|
-
if (dy < ty) dy = Math.min(dy + 0.1, ty);
|
|
37
|
-
else if (dy > ty) dy = Math.max(dy - 0.1, ty);
|
|
38
|
-
if (tick - prev > 100) {
|
|
39
|
-
next();
|
|
40
|
-
prev = tick;
|
|
41
|
-
}
|
|
42
|
-
for (const node of nodes()) {
|
|
43
|
-
const diff = tick - (node as any).c;
|
|
44
|
-
node.setAttribute('x', String((dx * diff) / 20));
|
|
45
|
-
node.setAttribute('y', String((dy * diff) / 20));
|
|
46
|
-
}
|
|
47
|
-
tick++;
|
|
48
|
-
requestAnimationFrame(animate);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
13
|
handle(doc, 'DOMContentLoaded', () => {
|
|
52
14
|
initBase();
|
|
53
15
|
|
|
54
16
|
logo = $('#logo')!;
|
|
55
17
|
if (!logo) return;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
handle(window, 'focus', () => {
|
|
62
|
-
for (const node of nodes()) {
|
|
63
|
-
(node as any).a.play();
|
|
64
|
-
}
|
|
65
|
-
});
|
|
18
|
+
nodes = new Array(9).fill(0).map(USE);
|
|
19
|
+
logo.after(...nodes);
|
|
20
|
+
|
|
66
21
|
handle(doc, 'mousemove', ({ x, y }: MouseEvent) => {
|
|
67
22
|
const rw = innerWidth / 2;
|
|
68
23
|
const rh = innerHeight / 2;
|
|
69
|
-
tx = (rw - x) / rw;
|
|
70
|
-
ty = (rh - y) / rh;
|
|
24
|
+
const tx = (rw - x) / rw;
|
|
25
|
+
const ty = (rh - y) / rh;
|
|
26
|
+
for (let [i, node] of nodes.entries()) {
|
|
27
|
+
i++;
|
|
28
|
+
node.style.translate = `${tx * i * 4}px ${ty * i * 4}px`;
|
|
29
|
+
}
|
|
71
30
|
});
|
|
72
|
-
requestAnimationFrame(animate);
|
|
73
31
|
});
|
|
@@ -116,6 +116,13 @@ aside
|
|
|
116
116
|
@import '_article/kbd'
|
|
117
117
|
@import '_article/links'
|
|
118
118
|
|
|
119
|
+
.article-outdate
|
|
120
|
+
@extend blockquote
|
|
121
|
+
padding 16px
|
|
122
|
+
border-color var(--note-warn)
|
|
123
|
+
&:not(.article-outdate-show)
|
|
124
|
+
display none
|
|
125
|
+
|
|
119
126
|
// MARK: Mobile
|
|
120
127
|
nav .toc
|
|
121
128
|
position absolute
|
package/assets/styles/home.styl
CHANGED
|
@@ -12,8 +12,22 @@ header
|
|
|
12
12
|
.home-title
|
|
13
13
|
font 28px var(--font-title)
|
|
14
14
|
|
|
15
|
+
@keyframes home-logo
|
|
16
|
+
100%
|
|
17
|
+
opacity var(--e-o)
|
|
18
|
+
x var(--e-p)
|
|
19
|
+
y var(--e-p)
|
|
20
|
+
|
|
15
21
|
.home-logo
|
|
16
22
|
max-width 350px
|
|
23
|
+
for i in 1 .. 9
|
|
24
|
+
&>:nth-child({i + 1})
|
|
25
|
+
opacity 1 - i * .1
|
|
26
|
+
animation 1s home-logo linear infinite
|
|
27
|
+
--e-o .9 - i * .1
|
|
28
|
+
--e-p 16px * i
|
|
29
|
+
x 16px * i - 16px
|
|
30
|
+
y 16px * i - 16px
|
|
17
31
|
|
|
18
32
|
@keyframes indicator
|
|
19
33
|
0%
|
package/dist/config.d.ts
CHANGED
|
@@ -103,6 +103,8 @@ export interface ThemeConfig {
|
|
|
103
103
|
walineCSS?: string;
|
|
104
104
|
/** @default 'https://unpkg.com/@waline/client@v3/dist/waline.js' */
|
|
105
105
|
walineJS?: string;
|
|
106
|
+
/** @default 'https://unpkg.com/mermaid@11/dist/mermaid.esm.min.mjs' */
|
|
107
|
+
mermaid?: string;
|
|
106
108
|
};
|
|
107
109
|
/** HTML 头部插入内容 */
|
|
108
110
|
inject?: string;
|
package/dist/index.js
CHANGED
|
@@ -446,38 +446,22 @@ const EXTERNAL_MODULES = Object.fromEntries([
|
|
|
446
446
|
"ezal",
|
|
447
447
|
"@js-temporal/polyfill"
|
|
448
448
|
].map((name) => [name, require(name)]));
|
|
449
|
-
function createRenderer(template) {
|
|
450
|
-
return (page) => {
|
|
451
|
-
const { site } = (0, ezal.getConfig)();
|
|
452
|
-
const context = {
|
|
453
|
-
page,
|
|
454
|
-
site,
|
|
455
|
-
theme: getThemeConfig(),
|
|
456
|
-
getImageInfo,
|
|
457
|
-
mime: mime_types.default,
|
|
458
|
-
compareByDate
|
|
459
|
-
};
|
|
460
|
-
try {
|
|
461
|
-
return template(context);
|
|
462
|
-
} catch (error) {
|
|
463
|
-
return (0, ezal.normalizeError)(error);
|
|
464
|
-
}
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
async function compiler(src) {
|
|
468
|
-
try {
|
|
469
|
-
const { renderer: template, dependencies } = await (0, ezal_layout.compile)(src, EXTERNAL_MODULES);
|
|
470
|
-
return {
|
|
471
|
-
renderer: createRenderer(template),
|
|
472
|
-
dependencies
|
|
473
|
-
};
|
|
474
|
-
} catch (error) {
|
|
475
|
-
return (0, ezal.normalizeError)(error);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
449
|
const layoutConfig = {
|
|
479
450
|
root: node_path.default.join(__dirname, "../layouts"),
|
|
480
|
-
compiler
|
|
451
|
+
compiler: (0, ezal_layout.createCompiler)({
|
|
452
|
+
context(page) {
|
|
453
|
+
const { site } = (0, ezal.getConfig)();
|
|
454
|
+
return {
|
|
455
|
+
page,
|
|
456
|
+
site,
|
|
457
|
+
theme: getThemeConfig(),
|
|
458
|
+
getImageInfo,
|
|
459
|
+
mime: mime_types.default,
|
|
460
|
+
compareByDate
|
|
461
|
+
};
|
|
462
|
+
},
|
|
463
|
+
external: EXTERNAL_MODULES
|
|
464
|
+
})
|
|
481
465
|
};
|
|
482
466
|
|
|
483
467
|
//#endregion
|
|
@@ -971,7 +955,7 @@ async function highlighter(code, lang) {
|
|
|
971
955
|
if ((0, ezal.getMode)() === "serve") updateStyles(toClass.getCSS());
|
|
972
956
|
return [html, lang];
|
|
973
957
|
}
|
|
974
|
-
const { $: $$
|
|
958
|
+
const { $: $$10 } = ezal_markdown.utils;
|
|
975
959
|
function packager(html, lang, extra) {
|
|
976
960
|
const name = LANGUAGE_MAP.get(lang) ?? lang;
|
|
977
961
|
let mtk = "";
|
|
@@ -982,18 +966,18 @@ function packager(html, lang, extra) {
|
|
|
982
966
|
else if (name$1.startsWith("mtk-")) mtk = name$1;
|
|
983
967
|
return `class="${result.join(" ")}"`;
|
|
984
968
|
}).replace(PATTERN_EMPTY_LINE, "</code></pre>");
|
|
985
|
-
return $$
|
|
969
|
+
return $$10("figure", {
|
|
986
970
|
class: [
|
|
987
971
|
"code",
|
|
988
972
|
"rounded",
|
|
989
973
|
mtk
|
|
990
974
|
],
|
|
991
|
-
html: [$$
|
|
975
|
+
html: [$$10("figcaption", {
|
|
992
976
|
class: ["sticky", "rounded"],
|
|
993
977
|
html: [
|
|
994
|
-
$$
|
|
978
|
+
$$10("code", name),
|
|
995
979
|
extra,
|
|
996
|
-
$$
|
|
980
|
+
$$10("button", {
|
|
997
981
|
class: ["link", "icon-copy"],
|
|
998
982
|
attr: { title: "复制代码" }
|
|
999
983
|
})
|
|
@@ -1033,16 +1017,16 @@ function setupCodeblockStyle() {
|
|
|
1033
1017
|
|
|
1034
1018
|
//#endregion
|
|
1035
1019
|
//#region packages/ezal-theme-example/src/markdown/fold.ts
|
|
1036
|
-
const PATTERN_START$
|
|
1037
|
-
const { $: $$
|
|
1020
|
+
const PATTERN_START$3 = /(?<=^|\n) {0,3}(\+{3,}) {0,3}(\S.*)\n/;
|
|
1021
|
+
const { $: $$9 } = ezal_markdown.utils;
|
|
1038
1022
|
const fold = {
|
|
1039
1023
|
name: "fold",
|
|
1040
1024
|
type: "block",
|
|
1041
1025
|
order: 0,
|
|
1042
1026
|
priority: 0,
|
|
1043
|
-
start: PATTERN_START$
|
|
1027
|
+
start: PATTERN_START$3,
|
|
1044
1028
|
parse(source$1, { md }) {
|
|
1045
|
-
const matched = source$1.match(PATTERN_START$
|
|
1029
|
+
const matched = source$1.match(PATTERN_START$3);
|
|
1046
1030
|
if (!matched) return;
|
|
1047
1031
|
const size = matched[1].length;
|
|
1048
1032
|
const summary = matched[2];
|
|
@@ -1058,12 +1042,12 @@ const fold = {
|
|
|
1058
1042
|
};
|
|
1059
1043
|
},
|
|
1060
1044
|
render({ children: [summary, details] }) {
|
|
1061
|
-
return $$
|
|
1045
|
+
return $$9("details", {
|
|
1062
1046
|
class: "rounded",
|
|
1063
|
-
html: [$$
|
|
1047
|
+
html: [$$9("summary", {
|
|
1064
1048
|
class: ["rounded", "sticky"],
|
|
1065
1049
|
html: summary.html
|
|
1066
|
-
}), $$
|
|
1050
|
+
}), $$9("div", {
|
|
1067
1051
|
class: "sticky-content",
|
|
1068
1052
|
html: details.html
|
|
1069
1053
|
})]
|
|
@@ -1073,7 +1057,7 @@ const fold = {
|
|
|
1073
1057
|
|
|
1074
1058
|
//#endregion
|
|
1075
1059
|
//#region packages/ezal-theme-example/src/markdown/footnote.ts
|
|
1076
|
-
const { eachLine, $: $$
|
|
1060
|
+
const { eachLine, $: $$8 } = ezal_markdown.utils;
|
|
1077
1061
|
const PATTERN_SOURCE_START = /(?<=^|\n)\[\^.*?\]:/;
|
|
1078
1062
|
const PATTERN_SOURCE_BEGIN = /^\[(.*?)\]:/;
|
|
1079
1063
|
const PATTERN_SOURCE_INDENT = /^(\t| {1,4})/;
|
|
@@ -1082,7 +1066,7 @@ const render = {
|
|
|
1082
1066
|
type: "inline",
|
|
1083
1067
|
render({ id, label }, { counter }) {
|
|
1084
1068
|
counter.count(label);
|
|
1085
|
-
return $$
|
|
1069
|
+
return $$8("sup", $$8("a", {
|
|
1086
1070
|
class: "footnote",
|
|
1087
1071
|
attr: { href: id },
|
|
1088
1072
|
content: label
|
|
@@ -1160,10 +1144,10 @@ const source = {
|
|
|
1160
1144
|
render({ id, children }, { counter }) {
|
|
1161
1145
|
for (const [label] of id) counter.count(label);
|
|
1162
1146
|
for (const child of children) counter.count(child.raw);
|
|
1163
|
-
return $$
|
|
1147
|
+
return $$8("dl", children.flatMap((child, i) => [$$8("dt", {
|
|
1164
1148
|
content: id[i][0],
|
|
1165
1149
|
id: id[i][1]
|
|
1166
|
-
}), $$
|
|
1150
|
+
}), $$8("dd", child.html)]));
|
|
1167
1151
|
}
|
|
1168
1152
|
};
|
|
1169
1153
|
const footnote = {
|
|
@@ -1174,9 +1158,9 @@ const footnote = {
|
|
|
1174
1158
|
|
|
1175
1159
|
//#endregion
|
|
1176
1160
|
//#region packages/ezal-theme-example/src/markdown/image.ts
|
|
1177
|
-
const { $: $$
|
|
1161
|
+
const { $: $$7 } = ezal_markdown.utils;
|
|
1178
1162
|
function img(info, src, alt, title) {
|
|
1179
|
-
return $$
|
|
1163
|
+
return $$7("img", {
|
|
1180
1164
|
attr: {
|
|
1181
1165
|
src: ezal.URL.for(src),
|
|
1182
1166
|
alt,
|
|
@@ -1191,12 +1175,12 @@ function img(info, src, alt, title) {
|
|
|
1191
1175
|
function renderImage(url, alt, title, page) {
|
|
1192
1176
|
const info = getImageInfo(ezal.URL.resolve(page.url, url));
|
|
1193
1177
|
if (!info?.rule) return img(info, url, alt, title);
|
|
1194
|
-
const html = info.rule.slice(0, -1).map((ext) => $$
|
|
1178
|
+
const html = info.rule.slice(0, -1).map((ext) => $$7("source", { attr: {
|
|
1195
1179
|
srcset: ezal.URL.extname(url, `.opt${ext}`),
|
|
1196
1180
|
type: mime_types.default.lookup(ext)
|
|
1197
1181
|
} }));
|
|
1198
1182
|
html.push(img(info, ezal.URL.extname(url, info.rule.at(-1)), alt, title));
|
|
1199
|
-
return $$
|
|
1183
|
+
return $$7("picture", html);
|
|
1200
1184
|
}
|
|
1201
1185
|
const blockRender = {
|
|
1202
1186
|
name: "image",
|
|
@@ -1204,9 +1188,9 @@ const blockRender = {
|
|
|
1204
1188
|
render({ title, url, alt }, { shared, counter }) {
|
|
1205
1189
|
const page = shared.page;
|
|
1206
1190
|
const html = [renderImage(url, alt, title, page)];
|
|
1207
|
-
html.push($$
|
|
1191
|
+
html.push($$7("figcaption", { content: alt }));
|
|
1208
1192
|
counter.count(alt);
|
|
1209
|
-
return $$
|
|
1193
|
+
return $$7("figure", {
|
|
1210
1194
|
class: "image",
|
|
1211
1195
|
html
|
|
1212
1196
|
});
|
|
@@ -1259,7 +1243,7 @@ const image = {
|
|
|
1259
1243
|
//#endregion
|
|
1260
1244
|
//#region packages/ezal-theme-example/src/markdown/kbd.ts
|
|
1261
1245
|
const PATTERN = /{{\S+?}}/;
|
|
1262
|
-
const { $: $$
|
|
1246
|
+
const { $: $$6 } = ezal_markdown.utils;
|
|
1263
1247
|
const kbd = {
|
|
1264
1248
|
name: "kbd",
|
|
1265
1249
|
type: "inline",
|
|
@@ -1276,14 +1260,14 @@ const kbd = {
|
|
|
1276
1260
|
},
|
|
1277
1261
|
render({ key }, { counter }) {
|
|
1278
1262
|
counter.count(key);
|
|
1279
|
-
return $$
|
|
1263
|
+
return $$6("kbd", { content: key });
|
|
1280
1264
|
}
|
|
1281
1265
|
};
|
|
1282
1266
|
|
|
1283
1267
|
//#endregion
|
|
1284
1268
|
//#region packages/ezal-theme-example/src/markdown/link.ts
|
|
1285
1269
|
const PATTERN_ABSOLUTE_LINK = /^[a-z][a-z0-9+.-]*:|^\/\//;
|
|
1286
|
-
const { $: $$
|
|
1270
|
+
const { $: $$5 } = ezal_markdown.utils;
|
|
1287
1271
|
const link = {
|
|
1288
1272
|
name: "link",
|
|
1289
1273
|
type: "inline",
|
|
@@ -1296,7 +1280,7 @@ const link = {
|
|
|
1296
1280
|
render(node) {
|
|
1297
1281
|
const html = [...node.entires().map((node$1) => node$1.html)];
|
|
1298
1282
|
const target = PATTERN_ABSOLUTE_LINK.test(node.destination) ? "_blank" : void 0;
|
|
1299
|
-
return $$
|
|
1283
|
+
return $$5("a", {
|
|
1300
1284
|
attr: {
|
|
1301
1285
|
href: ezal.URL.for(node.destination),
|
|
1302
1286
|
target,
|
|
@@ -1312,7 +1296,7 @@ const link = {
|
|
|
1312
1296
|
const PATTERN_ALL = /(?<=^|\n)@@\n.*?\n@@(\n|$)/s;
|
|
1313
1297
|
const PATTERN_EACH = /(?<=^|\n)@ ?([^@\n].*\n){2,3}/g;
|
|
1314
1298
|
const PATTERN_WHITESPACE = /\s+/;
|
|
1315
|
-
const { $: $$
|
|
1299
|
+
const { $: $$4 } = ezal_markdown.utils;
|
|
1316
1300
|
const links = {
|
|
1317
1301
|
name: "links",
|
|
1318
1302
|
type: "block",
|
|
@@ -1338,27 +1322,27 @@ const links = {
|
|
|
1338
1322
|
};
|
|
1339
1323
|
},
|
|
1340
1324
|
render({ links: links$1 }, { counter }) {
|
|
1341
|
-
return $$
|
|
1325
|
+
return $$4("div", {
|
|
1342
1326
|
class: "links",
|
|
1343
1327
|
html: links$1.map(({ href, icon, title, subtitle }) => {
|
|
1344
|
-
const html = [$$
|
|
1345
|
-
if (icon) html.push($$
|
|
1328
|
+
const html = [$$4("i", { class: ["icon-link"] })];
|
|
1329
|
+
if (icon) html.push($$4("img", {
|
|
1346
1330
|
class: "rounded",
|
|
1347
1331
|
attr: {
|
|
1348
1332
|
src: ezal.URL.for(icon),
|
|
1349
1333
|
alt: title
|
|
1350
1334
|
}
|
|
1351
1335
|
}));
|
|
1352
|
-
html.push($$
|
|
1336
|
+
html.push($$4("div", {
|
|
1353
1337
|
class: "link-title",
|
|
1354
1338
|
content: title
|
|
1355
1339
|
}));
|
|
1356
1340
|
counter.count(title);
|
|
1357
1341
|
if (subtitle) {
|
|
1358
|
-
html.push($$
|
|
1342
|
+
html.push($$4("div", { content: subtitle }));
|
|
1359
1343
|
counter.count(subtitle);
|
|
1360
1344
|
}
|
|
1361
|
-
return $$
|
|
1345
|
+
return $$4("a", {
|
|
1362
1346
|
class: "rounded",
|
|
1363
1347
|
html,
|
|
1364
1348
|
attr: { href: ezal.URL.for(href) }
|
|
@@ -1368,6 +1352,39 @@ const links = {
|
|
|
1368
1352
|
}
|
|
1369
1353
|
};
|
|
1370
1354
|
|
|
1355
|
+
//#endregion
|
|
1356
|
+
//#region packages/ezal-theme-example/src/markdown/mermaid.ts
|
|
1357
|
+
const PATTERN_START$2 = /(?<=^|\n)( {0,3})(`{3,}|~{3,})\s*mermaid\s*(?=$|\n)/i;
|
|
1358
|
+
const { $: $$3 } = ezal_markdown.utils;
|
|
1359
|
+
const mermaid = {
|
|
1360
|
+
name: "mermaid",
|
|
1361
|
+
type: "block",
|
|
1362
|
+
order: 0,
|
|
1363
|
+
priority: 1,
|
|
1364
|
+
start: PATTERN_START$2,
|
|
1365
|
+
parse(source$1) {
|
|
1366
|
+
const start = source$1.match(PATTERN_START$2);
|
|
1367
|
+
if (!start) return;
|
|
1368
|
+
const fenceLength = start[2].length;
|
|
1369
|
+
const fenceType = start[2][0];
|
|
1370
|
+
const startOffset = start[0].length;
|
|
1371
|
+
const end = source$1.slice(startOffset).match(/* @__PURE__ */ new RegExp(`(?<=\n)( {0,3})${fenceType}{${fenceLength},}[ \t]*(\n|$)`));
|
|
1372
|
+
const raw = source$1.slice(0, end?.index ? startOffset + end.index + end[0].length : void 0);
|
|
1373
|
+
return {
|
|
1374
|
+
raw,
|
|
1375
|
+
content: raw.slice(startOffset + 1, end?.index ? startOffset + end.index : void 0)
|
|
1376
|
+
};
|
|
1377
|
+
},
|
|
1378
|
+
render({ content }, { shared, counter }) {
|
|
1379
|
+
counter.count(content);
|
|
1380
|
+
shared.mermaid = true;
|
|
1381
|
+
return $$3("pre", {
|
|
1382
|
+
class: "mermaid",
|
|
1383
|
+
content
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
};
|
|
1387
|
+
|
|
1371
1388
|
//#endregion
|
|
1372
1389
|
//#region packages/ezal-theme-example/src/markdown/note.ts
|
|
1373
1390
|
const PATTERN_START$1 = /(?<=^|\n) {0,3}(!{3,}) ?(info|tip|warn|danger)(.*)\n/;
|
|
@@ -1604,7 +1621,7 @@ const setext = {
|
|
|
1604
1621
|
render: () => ""
|
|
1605
1622
|
};
|
|
1606
1623
|
async function markdownPageHandler() {
|
|
1607
|
-
renderer.set(ezal_markdown.plugins.heading({ shiftLevels: true }), image, table, await codeblock(), footnote, tex, tabs, note, fold, kbd, links, setext, link);
|
|
1624
|
+
renderer.set(ezal_markdown.plugins.heading({ shiftLevels: true }), image, table, await codeblock(), footnote, tex, tabs, note, fold, kbd, links, setext, link, mermaid);
|
|
1608
1625
|
return {
|
|
1609
1626
|
exts: ".md",
|
|
1610
1627
|
async parser(src) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["config: ThemeConfig","config","author: Author","feed: Feed","assets: { rss: FeedAsset; atom: FeedAsset; feed: FeedAsset }","VirtualAssets","#type","feed","theme","Feed","Article","Category","assets","item","image","URL","item: Item","dir: string | undefined","path","dir","sharp","VirtualAssets","URL","asset","#filepath","#ext","#optimizedPath","fs","db: DB.Database","statements: Record<'get' | 'update' | 'delete', DB.Statement>","path","DB","asset","color: string | null","Vibrant","metadata: ImageMetadata","path","logger","Logger","asset","ext","fs","assets","logger","Logger","urls: string[]","Article","Page","IndexNow","SEARCH_ENGINES","context: Context","layoutConfig: LayoutConfig","path","path","cleaner","CleanCSS","VirtualAssets","Cache","#baseCache","asset: CodeblockStyle","asset","ModelOperations","shiki: HighlighterGeneric<BundledLanguage, BundledTheme>","shikiClassName: string[]","transformers: ShikiTransformer[]","shiki","theme","utils","result: string[]","name","$","origin","plugins","render","indented: CommonPlugin<'block', CodeblockParsed>","fenced: CommonPlugin<'block', CodeblockParsed>","PATTERN_START","utils","fold: CommonPlugin<'block', FoldParsed>","source","$","utils","render: RendererPlugin<'inline', LinkParsed>","$","ast: ASTPlugin<'inline', LinkNode>","LinkNode","ParsedNode","source: CommonPlugin<'block', SourceParsed>","contents: string[]","id: [string, string][]","indentState: boolean | null","source","utils","$","URL","html: string[]","mime","blockRender: RendererPlugin<'block', ImageParsed>","block: ASTPlugin<'inline', ParsedNode>","Paragraph","ImageNode","image","ParsedNode","inline: ASTPlugin<'inline', ImageNode>","node","utils","kbd: CommonPlugin<'inline', KbdParsed>","source","$","utils","link: ASTPlugin<'inline', LinkNode>","LinkNode","node","$","URL","utils","links: CommonPlugin<'block', LinksParsed>","source","matched","$","links","html: string[]","URL","PATTERN_START","utils","NOTE_TITLE: Record<string, string>","note: CommonPlugin<'block', NoteParsed>","source","$","utils","plugins","table: typeof origin","$","source","utils","tabs: CommonPlugin<'block', TabsParsed, number>","source","children: TabsParsed['children']","id: TabsParsed['id']","content","inline: CommonPlugin<'inline', TexParsed>","source","tex","logger","block: CommonPlugin<'block', TexParsed>","logger","Logger","EzalMarkdown","setext: CommonPlugin<'block'>","plugins","fs","config","VirtualPage","indexPage: ArchivePage","getArticles","Article","VirtualPage","scanned","createPage","data: CategoryPageData","VirtualPage","scanned","Category","pages: HomePage[]","index","Article","createPage","data: HomePageData","VirtualPage","scanned","data: TagPageData","VirtualPage","Tag","Logger","index: pagefind.PagefindIndex","VirtualAssets","path","asset","Article","errors: string[]","Page","img","URL","VirtualAssets","SitemapStream","Article","Page","asset: Sitemap","scriptTransformRule: TransformRule","path","src","STYLE_CONFIGS: Record<string, () => any>","CleanCSS","styleTransformRule: TransformRule","fs","renderer","path","config","path"],"sources":["../src/config.ts","../src/utils.ts","../src/feed.ts","../src/image/utils.ts","../src/image/asset.ts","../src/image/db.ts","../src/image/metadata.ts","../src/image/index.ts","../src/index-now.ts","../src/layout.ts","../src/markdown/codeblock/data.ts","../src/markdown/codeblock/style.ts","../src/markdown/codeblock/index.ts","../src/markdown/fold.ts","../src/markdown/footnote.ts","../src/markdown/image.ts","../src/markdown/kbd.ts","../src/markdown/link.ts","../src/markdown/links.ts","../src/markdown/note.ts","../src/markdown/table.ts","../src/markdown/tabs.ts","../src/markdown/tex.ts","../src/markdown/index.ts","../src/page/404.ts","../src/page/archive.ts","../src/page/category.ts","../src/page/home.ts","../src/page/tag.ts","../src/pagefind.ts","../src/sitemap.ts","../src/transform/script.ts","../src/transform/stylus.ts","../src/index.ts"],"sourcesContent":["import type { Temporal } from '@js-temporal/polyfill';\nimport type { ArrayOr } from 'ezal';\nimport type { TokenizeOptions } from 'ezal-markdown';\nimport type { RawTheme } from 'shiki';\n\nexport interface NavItem {\n\tname: string;\n\tlink: string;\n}\n\nexport interface Contact {\n\turl: string;\n\tname: string;\n\ticon: string;\n\tcolor: string;\n}\n\nexport interface Link {\n\tname: string;\n\tdescription: string;\n\tlink: string;\n\tavatar: string;\n\tcolor: string;\n}\n\nexport interface LinkGroup {\n\ttitle: string;\n\tdescription: string;\n\titems: Link[];\n}\n\nexport type LinkPageStyles =\n\t| 'image'\n\t| 'table'\n\t| 'heading'\n\t| 'list'\n\t| 'footnote'\n\t| 'tabs'\n\t| 'note'\n\t| 'fold'\n\t| 'kbd';\n\nexport interface ThemeConfig {\n\t/** 导航栏 */\n\tnav?: NavItem[];\n\t/** 站点图标 */\n\tfavicon?: ArrayOr<string>;\n\t/** 主题色 */\n\tcolor?: {\n\t\t/** @default '#006000' */\n\t\tlight?: string;\n\t\t/** @default '#00BB00' */\n\t\tdark?: string;\n\t};\n\t/** 建站时间 */\n\tsince?: Temporal.ZonedDateTime;\n\t/** 联系方式 */\n\tcontact?: Contact[];\n\t/** 友情链接 */\n\tlinks?: LinkGroup[];\n\t/**\n\t * 友情链接页面启用的样式\n\t * @default 全部启用\n\t */\n\tlinkPageStyles?: LinkPageStyles[];\n\t/** Markdown 配置 */\n\tmarkdown?: {\n\t\t/**\n\t\t * 换行规则\n\t\t * @description\n\t\t * - `common-mark`:CommonMark 规范,行尾 2+ 空格渲染为换行\n\t\t * - `soft`:软换行,换行符 `\\n` 渲染为换行\n\t\t * @default `common-mark`\n\t\t */\n\t\tlineBreak?: TokenizeOptions['lineBreak'];\n\t\t/**\n\t\t * 代码块主题\n\t\t * @default {light:'light-plus',dark:'dark-plus'}\n\t\t */\n\t\tcodeBlockTheme?: { light: RawTheme; dark: RawTheme };\n\t};\n\t/** 主页设置 */\n\thome?: {\n\t\t/**\n\t\t * 每页文章数量\n\t\t * @default 10\n\t\t */\n\t\tarticlesPrePage?: number;\n\t\tlogo?: {\n\t\t\tviewBox: string;\n\t\t\tg: string;\n\t\t};\n\t\tslogan?: string;\n\t};\n\timageCache?: {\n\t\t/**\n\t\t * 图像元数据缓存路径\n\t\t * @description\n\t\t * 支持绝对路径和相对路径,相对路径将以工作目录为起点。\n\t\t * 默认为工作目录下 `image-metadata.sqlite`。\n\t\t */\n\t\tmetadata?: string;\n\t\t/**\n\t\t * 优化版图像缓存路径\n\t\t * @description\n\t\t * 支持绝对路径和相对路径,相对路径将以工作目录为起点。\n\t\t * 默认为工作目录下 `cache`。\n\t\t */\n\t\toptimized?: string;\n\t};\n\tcdn?: {\n\t\t/** @default 'https://unpkg.com/katex@0.16.21/dist/katex.min.css' */\n\t\tkatex?: string;\n\t\t/** @default 'https://unpkg.com/@waline/client@v3/dist/waline.css' */\n\t\twalineCSS?: string;\n\t\t/** @default 'https://unpkg.com/@waline/client@v3/dist/waline.js' */\n\t\twalineJS?: string;\n\t};\n\t/** HTML 头部插入内容 */\n\tinject?: string;\n\t/** IndexNow 配置 */\n\tindexNow?: {\n\t\t/** Bing IndexNow 密钥 */\n\t\tbing?: string;\n\t\t/** Yandex IndexNow 密钥 */\n\t\tyandex?: string;\n\t};\n\t/** Waline 评论配置 */\n\twaline?: {\n\t\t/** 后端地址 */\n\t\tserverURL: string;\n\t\tvisitor?: boolean;\n\t\tcommentCount?: boolean;\n\t\tpageview?: boolean;\n\t\temoji?: string[];\n\t\treaction?: string[];\n\t};\n}\n\nlet config: ThemeConfig;\n\nexport function setThemeConfig(cfg?: ThemeConfig) {\n\tconfig = cfg ?? {};\n}\n\nexport function getThemeConfig() {\n\treturn config;\n}\n","import type { Article } from 'ezal';\n\nexport function compareByDate(a: Article, b: Article): number {\n\treturn b.date.epochMilliseconds - a.date.epochMilliseconds;\n}\n","import { Article, Category, getConfig, URL, VirtualAssets } from 'ezal';\nimport { type Author, Feed, type Item } from 'feed';\nimport { getThemeConfig } from './config';\nimport { compareByDate } from './utils';\n\nconst FEED_TYPE_URL = {\n\trss: '/rss.xml',\n\tatom: '/atom.xml',\n\tfeed: '/feed.json',\n} as const;\n\nlet author: Author;\nlet feed: Feed;\nlet assets: { rss: FeedAsset; atom: FeedAsset; feed: FeedAsset };\n\nclass FeedAsset extends VirtualAssets {\n\t#type: 'rss' | 'atom' | 'feed';\n\tconstructor(type: 'rss' | 'atom' | 'feed') {\n\t\tsuper(FEED_TYPE_URL[type]);\n\t\tthis.#type = type;\n\t}\n\tbuild() {\n\t\tswitch (this.#type) {\n\t\t\tcase 'rss':\n\t\t\t\treturn feed.rss2();\n\t\t\tcase 'atom':\n\t\t\t\treturn feed.atom1();\n\t\t\tcase 'feed':\n\t\t\t\treturn feed.json1();\n\t\t\tdefault:\n\t\t\t\treturn '';\n\t\t}\n\t}\n\tprotected onDependenciesChanged() {}\n}\n\nexport function initFeed() {\n\tconst { site } = getConfig();\n\tconst theme = getThemeConfig();\n\tconst since = theme.since?.year;\n\tauthor = { name: site.author, link: site.domain };\n\tfeed = new Feed({\n\t\ttitle: site.title,\n\t\tdescription: site.description,\n\t\tid: site.domain,\n\t\tlanguage: site.language,\n\t\tfavicon: theme.favicon?.[0],\n\t\tcopyright: `© ${since ? `${since}-` : ''}${new Date().getFullYear()} ${site.author}`,\n\t\tauthor,\n\t\tupdated: new Date(),\n\t\tfeedLinks: {\n\t\t\trss: `${site.domain}/rss.xml`,\n\t\t\tatom: `${site.domain}/atom.xml`,\n\t\t\tjson: `${site.domain}/feed.json`,\n\t\t},\n\t});\n\tassets = {\n\t\trss: new FeedAsset('rss'),\n\t\tatom: new FeedAsset('atom'),\n\t\tfeed: new FeedAsset('feed'),\n\t};\n\tfor (const article of Article.getAll().sort(compareByDate)) {\n\t\tupdateFeedItem(article);\n\t}\n\tfor (const category of Category.getAll()) {\n\t\tupdateFeedCategory(category);\n\t}\n}\n\nfunction refreshAsset() {\n\tif (!assets) return;\n\tassets.rss.invalidated();\n\tassets.atom.invalidated();\n\tassets.feed.invalidated();\n}\n\nexport function updateFeedItem(article: Article) {\n\tif (!feed) return;\n\tconst i = feed.items.findIndex((item) => item.id === article.id);\n\t// Delete\n\tif (article.destroyed) {\n\t\tif (i === -1) return;\n\t\tfeed.items.splice(i, 1);\n\t\treturn refreshAsset();\n\t}\n\t// Update\n\tconst { site } = getConfig();\n\tlet image = article.data?.cover\n\t\t? URL.resolve(article.url, article.data.cover)\n\t\t: undefined;\n\tif (image) image = site.domain + image;\n\tconst item: Item = {\n\t\ttitle: article.title,\n\t\tid: article.id,\n\t\tlink: site.domain + article.url,\n\t\tdescription: article.description,\n\t\tcontent: article.content,\n\t\tauthor: [author],\n\t\tdate: new Date(article.date.toInstant().epochMilliseconds),\n\t\timage,\n\t\tcategory: article.categories\n\t\t\t.values()\n\t\t\t.toArray()\n\t\t\t.map((category) => ({ name: category.path.join('/') })),\n\t};\n\tif (i === -1) feed.addItem(item);\n\telse feed.items[i] = item;\n\trefreshAsset();\n}\n\nexport function updateFeedCategory(category: Category) {\n\tif (!feed) return;\n\tconst name = category.path.join('/');\n\tconst i = feed.categories.indexOf(name);\n\t// Delete\n\tif (category.destroyed) {\n\t\tif (i === -1) return;\n\t\tfeed.categories.splice(i, 1);\n\t\treturn refreshAsset();\n\t}\n\t// Update\n\tif (i !== -1) return;\n\tfeed.addCategory(name);\n\trefreshAsset();\n}\n","import path from 'node:path';\nimport { getThemeConfig } from '../config';\n\nlet dir: string | undefined;\nfunction getCacheDir(): string {\n\tif (dir) return dir;\n\tdir = getThemeConfig().imageCache?.optimized ?? 'cache';\n\tif (!path.isAbsolute(dir)) dir = path.resolve(dir);\n\treturn dir;\n}\n\nexport function getOptimizedPath(filepath: string, ext: string): string {\n\tconst dir = getCacheDir();\n\tconst cachePath = path.relative(process.cwd(), filepath);\n\treturn `${path.join(dir, cachePath)}.opt${ext}`;\n}\n","import { createReadStream } from 'node:fs';\nimport { type Asset, fs, URL, VirtualAssets } from 'ezal';\nimport Sharp from 'sharp';\nimport { getOptimizedPath } from './utils';\n\nconst OPTIMIZE = {\n\t'.avif': (sharp) => sharp.avif().toBuffer(),\n\t'.webp': (sharp) => sharp.webp().toBuffer(),\n\t'.jxl': (sharp) => sharp.jxl().toBuffer(),\n\t'.jpg': (sharp) =>\n\t\tsharp\n\t\t\t.jpeg({\n\t\t\t\ttrellisQuantisation: true,\n\t\t\t\tovershootDeringing: true,\n\t\t\t\tprogressive: true,\n\t\t\t\toptimiseScans: true,\n\t\t\t})\n\t\t\t.toBuffer(),\n\t'.png': (sharp) =>\n\t\tsharp.png({ progressive: true, adaptiveFiltering: true }).toBuffer(),\n\t'.gif': (sharp) => sharp.gif().toBuffer(),\n} as const satisfies Record<string, (sharp: Sharp.Sharp) => Promise<Buffer>>;\n\nexport type OptimizedImageExt = keyof typeof OPTIMIZE;\n\nexport class OptimizedImage extends VirtualAssets {\n\t#optimizedPath: string;\n\t#filepath: string;\n\t#ext: OptimizedImageExt;\n\t/**\n\t * @param asset 源资源\n\t * @param target 目标优化格式\n\t */\n\tconstructor(asset: Asset, ext: OptimizedImageExt) {\n\t\tsuper(URL.extname(asset.url, `.opt${ext}`));\n\t\tthis.#filepath = asset.filepath;\n\t\tthis.#ext = ext;\n\t\tthis.#optimizedPath = getOptimizedPath(this.#filepath, ext);\n\t}\n\tasync build() {\n\t\tif (await fs.isFile(this.#optimizedPath)) {\n\t\t\treturn createReadStream(this.#optimizedPath);\n\t\t}\n\t\tconst sharp = Sharp(this.#filepath);\n\t\tconst buffer = await OPTIMIZE[this.#ext](sharp);\n\t\tfs.writeFile(this.#optimizedPath, buffer);\n\t\treturn buffer;\n\t}\n\tprotected onDependenciesChanged() {}\n}\n","import path from 'node:path';\nimport DB from 'better-sqlite3';\nimport { getThemeConfig } from '../config';\n\nexport interface ImageMetadata {\n\tpath: string;\n\thash: string;\n\twidth: number;\n\theight: number;\n\tcolor: string | null;\n}\n\nlet db: DB.Database;\nlet statements: Record<'get' | 'update' | 'delete', DB.Statement>;\n\nfunction getMetadata(url: string): ImageMetadata | null {\n\treturn statements.get.get(url) as ImageMetadata | null;\n}\n\nfunction updateMetadata(data: ImageMetadata): boolean {\n\treturn (\n\t\tstatements.update.run(\n\t\t\tdata.path,\n\t\t\tdata.hash,\n\t\t\tdata.width,\n\t\t\tdata.height,\n\t\t\tdata.color,\n\t\t).changes !== 0\n\t);\n}\n\nfunction deleteMetadata(url: string): boolean {\n\treturn statements.delete.run(url).changes !== 0;\n}\n\nfunction initImageMetadataDB() {\n\tlet filename =\n\t\tgetThemeConfig().imageCache?.metadata ?? 'image-metadata.sqlite';\n\tif (!path.isAbsolute(filename)) filename = path.resolve(filename);\n\tdb = new DB(filename);\n\tdb.exec(`CREATE TABLE IF NOT EXISTS image_metadata (\n\t\tpath TEXT PRIMARY KEY,\n\t\thash TEXT NOT NULL,\n\t\twidth INTEGER NOT NULL,\n\t\theight INTEGER NOT NULL,\n\t\tcolor TEXT(8)\n\t)`);\n\tstatements = {\n\t\tget: db.prepare('SELECT * FROM image_metadata WHERE path = ?'),\n\t\tdelete: db.prepare('DELETE FROM image_metadata WHERE path = ?'),\n\t\tupdate: db.prepare(`INSERT OR REPLACE INTO image_metadata\n\t\t\t(path, hash, width, height, color)\n\t\t\tVALUES (?, ?, ?, ?, ?)\n\t\t`),\n\t};\n}\n\nexport const imageDB = {\n\tinit: initImageMetadataDB,\n\tget: getMetadata,\n\tupdate: updateMetadata,\n\tdelete: deleteMetadata,\n};\n","import { createHash } from 'node:crypto';\nimport { readFile } from 'node:fs/promises';\nimport type { Asset } from 'ezal';\nimport { Vibrant } from 'node-vibrant/node';\nimport Sharp from 'sharp';\nimport { type ImageMetadata, imageDB } from './db';\n\nexport async function updateImageMetadata(asset: Asset): Promise<boolean> {\n\tconst buffer = await readFile(asset.filepath);\n\t// Hash\n\tconst hash = createHash('sha256').update(buffer).digest('hex');\n\t// Check\n\tif (imageDB.get(asset.url)?.hash === hash) return false;\n\t// Size\n\tconst sharp = Sharp(buffer);\n\tconst { width, height, format } = await sharp.metadata();\n\t// Color\n\tlet color: string | null = null;\n\tif (format !== 'svg') {\n\t\ttry {\n\t\t\tconst palette = await Vibrant.from(buffer).getPalette();\n\t\t\tcolor = palette.Muted?.hex ?? null;\n\t\t} catch {}\n\t}\n\t// Update\n\tconst metadata: ImageMetadata = {\n\t\tpath: asset.url,\n\t\thash,\n\t\twidth,\n\t\theight,\n\t\tcolor,\n\t};\n\timageDB.update(metadata);\n\treturn true;\n}\n","import path from 'node:path/posix';\nimport { type Asset, fs, Logger } from 'ezal';\nimport { OptimizedImage, type OptimizedImageExt } from './asset';\nimport { type ImageMetadata, imageDB } from './db';\nimport { updateImageMetadata } from './metadata';\nimport { getOptimizedPath } from './utils';\n\nexport interface ImageInfo {\n\tmetadata: ImageMetadata | null;\n\trule?: string[];\n}\n\nconst INFO = {\n\tADD: 'Add image file:',\n\tUPDATE: 'Update image file:',\n\tREMOVE: 'Remove image file:',\n\tOPTIMIZE: (path: string) =>\n\t\t`The image \"${path}\" will be generated in this format:`,\n} as const;\nconst ERR = {\n\tMETADATA: (path: string) => `Unable to update metadata for \"${path}\"`,\n} as const;\n\nconst SUPPORT_EXTS = new Set<string>([\n\t'.jpeg',\n\t'.jpg',\n\t'.png',\n\t'.gif',\n\t'.webp',\n\t'.svg',\n\t'.tiff',\n\t'.tif',\n\t'.avif',\n\t'.heif',\n\t'.jxl',\n]);\n\nconst OPTIMIZE_RULES = new Map<string, OptimizedImageExt[]>([\n\t['.jpeg', ['.avif', '.webp', '.jxl', '.jpg']],\n\t['.jpg', ['.avif', '.webp', '.jpg']],\n\t['.png', ['.avif', '.webp', '.png']],\n\t['.webp', ['.avif', '.webp', '.png']],\n\t['.avif', ['.avif', '.webp', '.png']],\n]);\n\nconst logger = new Logger('theme:image');\n\nconst assetsMap = new Map<string, OptimizedImage[]>();\n\nexport function getImageInfo(url: string): ImageInfo | null {\n\tconst ext = path.extname(url).toLowerCase();\n\tif (!SUPPORT_EXTS.has(ext)) return null;\n\tconst metadata = imageDB.get(url);\n\tconst rule = OPTIMIZE_RULES.get(ext);\n\treturn { metadata, rule };\n}\n\nasync function cleanOptimized(asset: Asset) {\n\tconst ext = path.extname(asset.filepath).toLowerCase();\n\tconst rule = OPTIMIZE_RULES.get(ext);\n\tif (!rule) return;\n\tawait Promise.all(\n\t\trule\n\t\t\t.map((ext) => getOptimizedPath(asset.filepath, ext))\n\t\t\t.map((filepath) => fs.remove(filepath)),\n\t);\n}\n\nexport async function imageAddHook(asset: Asset) {\n\tif (asset.level !== 'user') return;\n\tconst ext = path.extname(asset.filepath).toLowerCase();\n\tif (!SUPPORT_EXTS.has(ext)) return;\n\tlogger.debug(INFO.ADD, asset.filepath);\n\tlet updated = false;\n\t// Metadata\n\ttry {\n\t\tupdated = await updateImageMetadata(asset);\n\t} catch (error) {\n\t\tlogger.error(ERR.METADATA(asset.filepath), error);\n\t}\n\t// Asset\n\tif (updated) await cleanOptimized(asset);\n\tconst rule = OPTIMIZE_RULES.get(ext);\n\tif (!rule) return;\n\tlogger.debug(INFO.OPTIMIZE(asset.filepath), rule);\n\tconst assets = rule\n\t\t.map<OptimizedImage | null>((ext) => {\n\t\t\ttry {\n\t\t\t\treturn new OptimizedImage(asset, ext);\n\t\t\t} catch (error) {\n\t\t\t\tlogger.warn(error);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t})\n\t\t.filter((v) => v) as OptimizedImage[];\n\tassetsMap.set(asset.url, assets);\n}\n\nexport async function imageUpdateHook(asset: Asset) {\n\tif (asset.level !== 'user') return;\n\tconst ext = path.extname(asset.filepath).toLowerCase();\n\tif (!SUPPORT_EXTS.has(ext)) return;\n\tlogger.debug(INFO.UPDATE, asset.filepath);\n\tlet updated = false;\n\t// Metadata\n\ttry {\n\t\tupdated = await updateImageMetadata(asset);\n\t} catch (error) {\n\t\tlogger.error(ERR.METADATA(asset.filepath), error);\n\t}\n\t// Asset\n\tif (updated) await cleanOptimized(asset);\n\tconst assets = assetsMap.get(asset.url);\n\tif (!assets) return;\n\tfor (const asset of assets) {\n\t\tasset.invalidated();\n\t}\n}\n\nexport function imageRemoveHook(asset: Asset) {\n\tif (asset.level !== 'user') return;\n\tconst ext = path.extname(asset.filepath).toLowerCase();\n\tif (!SUPPORT_EXTS.has(ext)) return;\n\tlogger.debug(INFO.REMOVE, asset.filepath);\n\timageDB.delete(asset.filepath);\n\tconst assets = assetsMap.get(asset.url);\n\tif (!assets) return;\n\tassetsMap.delete(asset.url);\n\tfor (const asset of assets) {\n\t\tasset.destroy();\n\t}\n}\n","import { Article, getConfig, Logger, Page } from 'ezal';\nimport IndexNow, { SEARCH_ENGINES } from 'indexnow';\nimport { getThemeConfig } from './config';\n\nconst logger = new Logger('theme:index-now');\n\nexport async function exeIndexNow() {\n\tconst { site } = getConfig();\n\tconst { indexNow } = getThemeConfig();\n\tif (!indexNow) return;\n\n\tlogger.log('Collecting data...');\n\tconst urls: string[] = [];\n\tfor (const article of Article.getAll()) {\n\t\tif (article.data?.robots === false) continue;\n\t\turls.push(site.domain + article.url);\n\t}\n\tfor (const page of Page.getAll()) {\n\t\tif (!page.data?.robots) continue;\n\t\turls.push(site.domain + page.url);\n\t}\n\n\tif (indexNow.bing) {\n\t\tlogger.log('Submitting urls to Bing...');\n\t\tconst bing = new IndexNow(SEARCH_ENGINES.BING, indexNow.bing);\n\t\tawait bing.submitUrls(site.domain, urls);\n\t}\n\n\tif (indexNow.yandex) {\n\t\tlogger.log('Submitting urls to Yandex...');\n\t\tconst bing = new IndexNow(SEARCH_ENGINES.YANDEX, indexNow.yandex);\n\t\tawait bing.submitUrls(site.domain, urls);\n\t}\n\n\tlogger.log('Finished');\n}\n","import path from 'node:path';\nimport {\n\ttype LayoutRenderer as EzalLayoutRenderer,\n\tgetConfig,\n\ttype LayoutCompiled,\n\ttype LayoutConfig,\n\tnormalizeError,\n\ttype PromiseOr,\n} from 'ezal';\nimport { compile, type LayoutRenderer } from 'ezal-layout';\nimport mime from 'mime-types';\nimport type { Context } from '../layouts/context';\nimport { getThemeConfig } from './config';\nimport { getImageInfo } from './image';\nimport { compareByDate } from './utils';\n\nconst EXTERNAL_MODULES = Object.fromEntries(\n\t['mime-types', 'ezal', '@js-temporal/polyfill'].map<[string, any]>((name) => [\n\t\tname,\n\t\trequire(name),\n\t]),\n);\n\nfunction createRenderer(template: LayoutRenderer) {\n\treturn (page: Context['page']): PromiseOr<string | Error> => {\n\t\tconst { site } = getConfig();\n\t\tconst theme = getThemeConfig();\n\t\tconst context: Context = {\n\t\t\tpage,\n\t\t\tsite,\n\t\t\ttheme,\n\t\t\tgetImageInfo,\n\t\t\tmime,\n\t\t\tcompareByDate,\n\t\t};\n\t\ttry {\n\t\t\treturn template(context);\n\t\t} catch (error) {\n\t\t\treturn normalizeError(error);\n\t\t}\n\t};\n}\n\nasync function compiler(src: string): Promise<LayoutCompiled | Error> {\n\ttry {\n\t\tconst { renderer: template, dependencies } = await compile(\n\t\t\tsrc,\n\t\t\tEXTERNAL_MODULES,\n\t\t);\n\t\treturn {\n\t\t\trenderer: createRenderer(template) as EzalLayoutRenderer,\n\t\t\tdependencies,\n\t\t};\n\t} catch (error) {\n\t\treturn normalizeError(error);\n\t}\n}\n\nexport const layoutConfig: LayoutConfig = {\n\troot: path.join(__dirname, '../layouts'),\n\tcompiler,\n};\n","export const LANGUAGE_MAP = new Map([\n\t['markup', 'Markup'],\n\t['html', 'HTML'],\n\t['xml', 'XML'],\n\t['svg', 'SVG'],\n\t['mathml', 'MathML'],\n\t['ssml', 'SSML'],\n\t['atom', 'Atom'],\n\t['rss', 'RSS'],\n\t['css', 'CSS'],\n\t['clike', 'C-like'],\n\t['javascript', 'JavaScript'],\n\t['js', 'JavaScript'],\n\t['abap', 'ABAP'],\n\t['abnf', 'ABNF'],\n\t['actionscript', 'ActionScript'],\n\t['ada', 'Ada'],\n\t['agda', 'Agda'],\n\t['al', 'AL'],\n\t['antlr4', 'ANTLR4'],\n\t['g4', 'ANTLR4'],\n\t['apacheconf', 'Apache Configuration'],\n\t['apex', 'Apex'],\n\t['apl', 'APL'],\n\t['applescript', 'AppleScript'],\n\t['aql', 'AQL'],\n\t['arduino', 'Arduino'],\n\t['ino', 'Arduino'],\n\t['arff', 'ARFF'],\n\t['armasm', 'ARM Assembly'],\n\t['arm-asm', 'ARM Assembly'],\n\t['arturo', 'Arturo'],\n\t['art', 'Arturo'],\n\t['asciidoc', 'AsciiDoc'],\n\t['adoc', 'AsciiDoc'],\n\t['aspnet', 'ASP.NET (C#)'],\n\t['asm6502', '6502 Assembly'],\n\t['asmatmel', 'Atmel AVR Assembly'],\n\t['autohotkey', 'AutoHotkey'],\n\t['autoit', 'AutoIt'],\n\t['avisynth', 'AviSynth'],\n\t['avs', 'AviSynth'],\n\t['avro-idl', 'Avro IDL'],\n\t['avdl', 'Avro IDL'],\n\t['awk', 'AWK'],\n\t['gawk', 'AWK'],\n\t['bash', 'Bash'],\n\t['sh', 'Bash'],\n\t['shell', 'Bash'],\n\t['basic', 'BASIC'],\n\t['batch', 'Batch'],\n\t['bbcode', 'BBcode'],\n\t['shortcode', 'BBcode'],\n\t['bbj', 'BBj'],\n\t['bicep', 'Bicep'],\n\t['birb', 'Birb'],\n\t['bison', 'Bison'],\n\t['bnf', 'BNF'],\n\t['rbnf', 'BNF'],\n\t['bqn', 'BQN'],\n\t['brainfuck', 'Brainfuck'],\n\t['brightscript', 'BrightScript'],\n\t['bro', 'Bro'],\n\t['bsl', 'BSL (1C:Enterprise)'],\n\t['oscript', 'BSL (1C:Enterprise)'],\n\t['c', 'C'],\n\t['csharp', 'C#'],\n\t['cs', 'C#'],\n\t['dotnet', 'C#'],\n\t['cpp', 'C++'],\n\t['cfscript', 'CFScript'],\n\t['cfc', 'CFScript'],\n\t['chaiscript', 'ChaiScript'],\n\t['cil', 'CIL'],\n\t['cilkc', 'Cilk/C'],\n\t['cilk-c', 'Cilk/C'],\n\t['cilkcpp', 'Cilk/C++'],\n\t['cilk-cpp', 'Cilk/C++'],\n\t['cilk', 'Cilk/C++'],\n\t['clojure', 'Clojure'],\n\t['cmake', 'CMake'],\n\t['cobol', 'COBOL'],\n\t['coffeescript', 'CoffeeScript'],\n\t['coffee', 'CoffeeScript'],\n\t['concurnas', 'Concurnas'],\n\t['conc', 'Concurnas'],\n\t['csp', 'Content-Security-Policy'],\n\t['cooklang', 'Cooklang'],\n\t['coq', 'Coq'],\n\t['crystal', 'Crystal'],\n\t['css-extras', 'CSS Extras'],\n\t['csv', 'CSV'],\n\t['cue', 'CUE'],\n\t['cypher', 'Cypher'],\n\t['d', 'D'],\n\t['dart', 'Dart'],\n\t['dataweave', 'DataWeave'],\n\t['dax', 'DAX'],\n\t['dhall', 'Dhall'],\n\t['diff', 'Diff'],\n\t['django', 'Django/Jinja2'],\n\t['jinja2', 'Django/Jinja2'],\n\t['dns-zone-file', 'DNS zone file'],\n\t['dns-zone', 'DNS zone file'],\n\t['docker', 'Docker'],\n\t['dockerfile', 'Docker'],\n\t['dot', 'DOT (Graphviz)'],\n\t['gv', 'DOT (Graphviz)'],\n\t['ebnf', 'EBNF'],\n\t['editorconfig', 'EditorConfig'],\n\t['eiffel', 'Eiffel'],\n\t['ejs', 'EJS'],\n\t['eta', 'EJS'],\n\t['elixir', 'Elixir'],\n\t['elm', 'Elm'],\n\t['etlua', 'Embedded Lua templating'],\n\t['erb', 'ERB'],\n\t['erlang', 'Erlang'],\n\t['excel-formula', 'Excel Formula'],\n\t['xlsx', 'Excel Formula'],\n\t['xls', 'Excel Formula'],\n\t['fsharp', 'F#'],\n\t['factor', 'Factor'],\n\t['false', 'False'],\n\t['firestore-security-rules', 'Firestore security rules'],\n\t['flow', 'Flow'],\n\t['fortran', 'Fortran'],\n\t['ftl', 'FreeMarker Template Language'],\n\t['gml', 'GameMaker Language'],\n\t['gamemakerlanguage', 'GameMaker Language'],\n\t['gap', 'GAP (CAS)'],\n\t['gcode', 'G-code'],\n\t['gdscript', 'GDScript'],\n\t['gedcom', 'GEDCOM'],\n\t['gettext', 'gettext'],\n\t['po', 'gettext'],\n\t['gherkin', 'Gherkin'],\n\t['git', 'Git'],\n\t['glsl', 'GLSL'],\n\t['gn', 'GN'],\n\t['gni', 'GN'],\n\t['linker-script', 'GNU Linker Script'],\n\t['ld', 'GNU Linker Script'],\n\t['go', 'Go'],\n\t['go-module', 'Go module'],\n\t['go-mod', 'Go module'],\n\t['gradle', 'Gradle'],\n\t['graphql', 'GraphQL'],\n\t['groovy', 'Groovy'],\n\t['haml', 'Haml'],\n\t['handlebars', 'Handlebars'],\n\t['hbs', 'Handlebars'],\n\t['mustache', 'Handlebars'],\n\t['haskell', 'Haskell'],\n\t['hs', 'Haskell'],\n\t['haxe', 'Haxe'],\n\t['hcl', 'HCL'],\n\t['hlsl', 'HLSL'],\n\t['hoon', 'Hoon'],\n\t['http', 'HTTP'],\n\t['hpkp', 'HTTP Public-Key-Pins'],\n\t['hsts', 'HTTP Strict-Transport-Security'],\n\t['ichigojam', 'IchigoJam'],\n\t['icon', 'Icon'],\n\t['icu-message-format', 'ICU Message Format'],\n\t['idris', 'Idris'],\n\t['idr', 'Idris'],\n\t['ignore', '.ignore'],\n\t['gitignore', '.ignore'],\n\t['hgignore', '.ignore'],\n\t['npmignore', '.ignore'],\n\t['inform7', 'Inform 7'],\n\t['ini', 'Ini'],\n\t['io', 'Io'],\n\t['j', 'J'],\n\t['java', 'Java'],\n\t['javadoc', 'JavaDoc'],\n\t['javadoclike', 'JavaDoc-like'],\n\t['javastacktrace', 'Java stack trace'],\n\t['jexl', 'Jexl'],\n\t['jolie', 'Jolie'],\n\t['jq', 'JQ'],\n\t['jsdoc', 'JSDoc'],\n\t['js-extras', 'JS Extras'],\n\t['json', 'JSON'],\n\t['webmanifest', 'JSON'],\n\t['json5', 'JSON5'],\n\t['jsonp', 'JSONP'],\n\t['jsstacktrace', 'JS stack trace'],\n\t['js-templates', 'JS Templates'],\n\t['julia', 'Julia'],\n\t['keepalived', 'Keepalived Configure'],\n\t['keyman', 'Keyman'],\n\t['kotlin', 'Kotlin'],\n\t['kt', 'Kotlin'],\n\t['kts', 'Kotlin'],\n\t['kumir', 'KuMir (КуМир)'],\n\t['kum', 'KuMir (КуМир)'],\n\t['kusto', 'Kusto'],\n\t['latex', 'LaTeX'],\n\t['tex', 'LaTeX'],\n\t['context', 'LaTeX'],\n\t['latte', 'Latte'],\n\t['less', 'Less'],\n\t['lilypond', 'LilyPond'],\n\t['ly', 'LilyPond'],\n\t['liquid', 'Liquid'],\n\t['lisp', 'Lisp'],\n\t['emacs', 'Lisp'],\n\t['elisp', 'Lisp'],\n\t['emacs-lisp', 'Lisp'],\n\t['livescript', 'LiveScript'],\n\t['llvm', 'LLVM IR'],\n\t['log', 'Log file'],\n\t['lolcode', 'LOLCODE'],\n\t['lua', 'Lua'],\n\t['magma', 'Magma (CAS)'],\n\t['makefile', 'Makefile'],\n\t['markdown', 'Markdown'],\n\t['md', 'Markdown'],\n\t['markup-templating', 'Markup templating'],\n\t['mata', 'Mata'],\n\t['matlab', 'MATLAB'],\n\t['maxscript', 'MAXScript'],\n\t['mel', 'MEL'],\n\t['mermaid', 'Mermaid'],\n\t['metafont', 'METAFONT'],\n\t['mizar', 'Mizar'],\n\t['mongodb', 'MongoDB'],\n\t['monkey', 'Monkey'],\n\t['moonscript', 'MoonScript'],\n\t['moon', 'MoonScript'],\n\t['n1ql', 'N1QL'],\n\t['n4js', 'N4JS'],\n\t['n4jsd', 'N4JS'],\n\t['nand2tetris-hdl', 'Nand To Tetris HDL'],\n\t['naniscript', 'Naninovel Script'],\n\t['nani', 'Naninovel Script'],\n\t['nasm', 'NASM'],\n\t['neon', 'NEON'],\n\t['nevod', 'Nevod'],\n\t['nginx', 'nginx'],\n\t['nim', 'Nim'],\n\t['nix', 'Nix'],\n\t['nsis', 'NSIS'],\n\t['objectivec', 'Objective-C'],\n\t['objc', 'Objective-C'],\n\t['ocaml', 'OCaml'],\n\t['odin', 'Odin'],\n\t['opencl', 'OpenCL'],\n\t['openqasm', 'OpenQasm'],\n\t['qasm', 'OpenQasm'],\n\t['oz', 'Oz'],\n\t['parigp', 'PARI/GP'],\n\t['parser', 'Parser'],\n\t['pascal', 'Pascal'],\n\t['objectpascal', 'Pascal'],\n\t['pascaligo', 'Pascaligo'],\n\t['psl', 'PATROL Scripting Language'],\n\t['pcaxis', 'PC-Axis'],\n\t['px', 'PC-Axis'],\n\t['peoplecode', 'PeopleCode'],\n\t['pcode', 'PeopleCode'],\n\t['perl', 'Perl'],\n\t['php', 'PHP'],\n\t['phpdoc', 'PHPDoc'],\n\t['php-extras', 'PHP Extras'],\n\t['plant-uml', 'PlantUML'],\n\t['plantuml', 'PlantUML'],\n\t['plsql', 'PL/SQL'],\n\t['powerquery', 'PowerQuery'],\n\t['pq', 'PowerQuery'],\n\t['mscript', 'PowerQuery'],\n\t['powershell', 'PowerShell'],\n\t['processing', 'Processing'],\n\t['prolog', 'Prolog'],\n\t['promql', 'PromQL'],\n\t['properties', '.properties'],\n\t['protobuf', 'Protocol Buffers'],\n\t['pug', 'Pug'],\n\t['puppet', 'Puppet'],\n\t['pure', 'Pure'],\n\t['purebasic', 'PureBasic'],\n\t['pbfasm', 'PureBasic'],\n\t['purescript', 'PureScript'],\n\t['purs', 'PureScript'],\n\t['python', 'Python'],\n\t['py', 'Python'],\n\t['qsharp', 'Q#'],\n\t['qs', 'Q#'],\n\t['q', 'Q (kdb+ database)'],\n\t['qml', 'QML'],\n\t['qore', 'Qore'],\n\t['r', 'R'],\n\t['racket', 'Racket'],\n\t['rkt', 'Racket'],\n\t['cshtml', 'Razor C#'],\n\t['razor', 'Razor C#'],\n\t['jsx', 'React JSX'],\n\t['tsx', 'React TSX'],\n\t['reason', 'Reason'],\n\t['regex', 'Regex'],\n\t['rego', 'Rego'],\n\t['renpy', \"Ren'py\"],\n\t['rpy', \"Ren'py\"],\n\t['rescript', 'ReScript'],\n\t['res', 'ReScript'],\n\t['rest', 'reST (reStructuredText)'],\n\t['rip', 'Rip'],\n\t['roboconf', 'Roboconf'],\n\t['robotframework', 'Robot Framework'],\n\t['robot', 'Robot Framework'],\n\t['ruby', 'Ruby'],\n\t['rb', 'Ruby'],\n\t['rust', 'Rust'],\n\t['sas', 'SAS'],\n\t['sass', 'Sass (Sass)'],\n\t['scss', 'Sass (SCSS)'],\n\t['scala', 'Scala'],\n\t['scheme', 'Scheme'],\n\t['shell-session', 'Shell session'],\n\t['sh-session', 'Shell session'],\n\t['shellsession', 'Shell session'],\n\t['smali', 'Smali'],\n\t['smalltalk', 'Smalltalk'],\n\t['smarty', 'Smarty'],\n\t['sml', 'SML'],\n\t['smlnj', 'SML'],\n\t['solidity', 'Solidity (Ethereum)'],\n\t['sol', 'Solidity (Ethereum)'],\n\t['solution-file', 'Solution file'],\n\t['sln', 'Solution file'],\n\t['soy', 'Soy (Closure Template)'],\n\t['sparql', 'SPARQL'],\n\t['rq', 'SPARQL'],\n\t['splunk-spl', 'Splunk SPL'],\n\t['sqf', 'SQF: Status Quo Function (Arma 3)'],\n\t['sql', 'SQL'],\n\t['squirrel', 'Squirrel'],\n\t['stan', 'Stan'],\n\t['stata', 'Stata Ado'],\n\t['iecst', 'Structured Text (IEC 61131-3)'],\n\t['stylus', 'Stylus'],\n\t['supercollider', 'SuperCollider'],\n\t['sclang', 'SuperCollider'],\n\t['swift', 'Swift'],\n\t['systemd', 'Systemd configuration file'],\n\t['t4-templating', 'T4 templating'],\n\t['t4-cs', 'T4 Text Templates (C#)'],\n\t['t4', 'T4 Text Templates (C#)'],\n\t['t4-vb', 'T4 Text Templates (VB)'],\n\t['tap', 'TAP'],\n\t['tcl', 'Tcl'],\n\t['tt2', 'Template Toolkit 2'],\n\t['textile', 'Textile'],\n\t['toml', 'TOML'],\n\t['tremor', 'Tremor'],\n\t['trickle', 'Tremor'],\n\t['troy', 'Tremor'],\n\t['turtle', 'Turtle'],\n\t['trig', 'Turtle'],\n\t['twig', 'Twig'],\n\t['typescript', 'TypeScript'],\n\t['ts', 'TypeScript'],\n\t['typoscript', 'TypoScript'],\n\t['tsconfig', 'TypoScript'],\n\t['unrealscript', 'UnrealScript'],\n\t['uscript', 'UnrealScript'],\n\t['uc', 'UnrealScript'],\n\t['uorazor', 'UO Razor Script'],\n\t['uri', 'URI'],\n\t['url', 'URI'],\n\t['v', 'V'],\n\t['vala', 'Vala'],\n\t['vbnet', 'VB.Net'],\n\t['velocity', 'Velocity'],\n\t['verilog', 'Verilog'],\n\t['vhdl', 'VHDL'],\n\t['vim', 'vim'],\n\t['visual-basic', 'Visual Basic'],\n\t['vb', 'Visual Basic'],\n\t['vba', 'Visual Basic'],\n\t['warpscript', 'WarpScript'],\n\t['wasm', 'WebAssembly'],\n\t['web-idl', 'Web IDL'],\n\t['webidl', 'Web IDL'],\n\t['wgsl', 'WGSL'],\n\t['wiki', 'Wiki markup'],\n\t['wolfram', 'Wolfram language'],\n\t['mathematica', 'Wolfram language'],\n\t['nb', 'Wolfram language'],\n\t['wl', 'Wolfram language'],\n\t['wren', 'Wren'],\n\t['xeora', 'Xeora'],\n\t['xeoracube', 'Xeora'],\n\t['xml-doc', 'XML doc (.net)'],\n\t['xojo', 'Xojo (REALbasic)'],\n\t['xquery', 'XQuery'],\n\t['yaml', 'YAML'],\n\t['yml', 'YAML'],\n\t['yang', 'YANG'],\n\t['zig', 'Zig'],\n]);\n","import { readFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport CleanCSS from 'clean-css';\nimport { Cache, getMode, VirtualAssets } from 'ezal';\nimport stylus from 'stylus';\n\nconst base = path.join(__dirname, '../assets/styles/_code.styl');\n\nconst cleaner = new CleanCSS();\n\nclass CodeblockStyle extends VirtualAssets {\n\t#baseCache = new Cache<string>();\n\textra = '';\n\tconstructor() {\n\t\tsuper('/styles/code.css');\n\t\tsuper.updateDependencies([base]);\n\t}\n\tasync build() {\n\t\tlet cache = this.#baseCache.get();\n\t\tif (!cache) {\n\t\t\tconst file = await readFile(base, 'utf8');\n\t\t\tcache = stylus.render(file);\n\t\t\tthis.#baseCache.set(cache);\n\t\t}\n\t\tconst result = this.extra + cache;\n\t\tif (getMode() !== 'build') return result;\n\t\treturn cleaner.minify(result).styles;\n\t}\n\tprotected onDependenciesChanged() {\n\t\tsuper.invalidated();\n\t\tthis.#baseCache.clean();\n\t}\n}\n\nlet asset: CodeblockStyle;\nexport function updateStyles(css: string) {\n\tif (css === asset.extra) return;\n\tasset.extra = css;\n\tasset.invalidated();\n}\n\nexport function initCodeblockStyle() {\n\tasset = new CodeblockStyle();\n}\n","import { transformerColorizedBrackets } from '@shikijs/colorized-brackets';\nimport {\n\ttransformerNotationDiff,\n\ttransformerNotationErrorLevel,\n\ttransformerNotationFocus,\n\ttransformerNotationHighlight,\n\ttransformerNotationWordHighlight,\n\ttransformerStyleToClass,\n} from '@shikijs/transformers';\nimport { ModelOperations } from '@vscode/vscode-languagedetection';\nimport { getMode } from 'ezal';\nimport {\n\ttype CodeblockParsed,\n\ttype CommonPlugin,\n\ttype PluginContext,\n\tplugins,\n\tutils,\n} from 'ezal-markdown';\nimport {\n\ttype BundledLanguage,\n\ttype BundledTheme,\n\tcreateHighlighter,\n\ttype HighlighterGeneric,\n\ttype ShikiTransformer,\n} from 'shiki';\nimport { getThemeConfig } from '../../config';\nimport { LANGUAGE_MAP } from './data';\nimport { updateStyles } from './style';\n\nconst PATTERN_CLASS = /class=\"([A-Za-z0-9 -]+)\"/;\nconst PATTERN_EMPTY_LINE =\n\t/\\n<span class=\"line\">(<span class=\"mtk-\\d+\"><\\/span>)?<\\/span><\\/code><\\/pre>$/;\n\nconst modelOperations = new ModelOperations();\n\nasync function getLang(code: string, lang?: string): Promise<string> {\n\tif (lang) return lang;\n\tconst result = await modelOperations.runModel(code);\n\treturn result.toSorted((a, b) => b.confidence - a.confidence)[0].languageId;\n}\n\nlet shiki: HighlighterGeneric<BundledLanguage, BundledTheme>;\nconst shikiClassName: string[] = [];\nconst toClass = transformerStyleToClass({\n\tclassReplacer(name) {\n\t\tlet i = shikiClassName.indexOf(name);\n\t\tif (i === -1) {\n\t\t\ti = shikiClassName.length;\n\t\t\tshikiClassName.push(name);\n\t\t}\n\t\treturn `mtk-${i}`;\n\t},\n});\nconst transformers: ShikiTransformer[] = [\n\ttransformerNotationDiff(),\n\ttransformerNotationHighlight(),\n\ttransformerNotationWordHighlight(),\n\ttransformerNotationFocus(),\n\ttransformerNotationErrorLevel(),\n\ttransformerColorizedBrackets(),\n\ttoClass,\n];\n\nasync function highlighter(\n\tcode: string,\n\tlang?: string,\n): Promise<[html: string, lang: string]> {\n\tlang = await getLang(code, lang);\n\tlet loadedLanguage = lang;\n\ttry {\n\t\tawait shiki.loadLanguage(lang as any);\n\t} catch {\n\t\tloadedLanguage = 'plain';\n\t}\n\tconst theme = getThemeConfig().markdown?.codeBlockTheme;\n\tconst html = await shiki.codeToHtml(code, {\n\t\tlang: loadedLanguage,\n\t\tthemes: {\n\t\t\tlight: theme?.light.name ?? 'light-plus',\n\t\t\tdark: theme?.dark.name ?? 'dark-plus',\n\t\t},\n\t\ttransformers,\n\t});\n\tif (getMode() === 'serve') updateStyles(toClass.getCSS());\n\treturn [html, lang];\n}\n\nconst { $ } = utils;\n\nfunction packager(html: string, lang: string, extra: string): string {\n\tconst name = LANGUAGE_MAP.get(lang) ?? lang;\n\tlet mtk = '';\n\thtml = html\n\t\t.replace(PATTERN_CLASS, (_, className: string) => {\n\t\t\tconst classes = className.split(' ');\n\t\t\tconst result: string[] = ['shiki'];\n\t\t\tfor (const name of classes) {\n\t\t\t\tif (name.startsWith('has-')) result.push(name);\n\t\t\t\telse if (name.startsWith('mtk-')) mtk = name;\n\t\t\t}\n\t\t\treturn `class=\"${result.join(' ')}\"`;\n\t\t})\n\t\t.replace(PATTERN_EMPTY_LINE, '</code></pre>');\n\treturn $('figure', {\n\t\tclass: ['code', 'rounded', mtk],\n\t\thtml: [\n\t\t\t$('figcaption', {\n\t\t\t\tclass: ['sticky', 'rounded'],\n\t\t\t\thtml: [\n\t\t\t\t\t$('code', name),\n\t\t\t\t\textra,\n\t\t\t\t\t$('button', { class: ['link', 'icon-copy'], attr: { title: '复制代码' } }),\n\t\t\t\t],\n\t\t\t}),\n\t\t\thtml,\n\t\t],\n\t});\n}\n\nconst origin = plugins.codeblock();\n\nasync function render(\n\t{ code, lang, children }: CodeblockParsed,\n\t{ shared, counter }: PluginContext,\n): Promise<string> {\n\tcounter.count(code);\n\tshared.codeblock = true;\n\tconst result = await highlighter(code, lang);\n\treturn packager(result[0], result[1], children?.html ?? '');\n}\n\nconst indented: CommonPlugin<'block', CodeblockParsed> = {\n\t...origin.indentedCodeblock,\n\trender,\n};\n\nconst fenced: CommonPlugin<'block', CodeblockParsed> = {\n\t...origin.fencedCodeblock,\n\trender,\n};\n\nexport async function codeblock() {\n\tconst theme = getThemeConfig().markdown?.codeBlockTheme;\n\tshiki = await createHighlighter({\n\t\tthemes: theme ? [theme.light, theme.dark] : ['light-plus', 'dark-plus'],\n\t\tlangs: [],\n\t});\n\treturn { indented, fenced };\n}\n\nexport function setupCodeblockStyle() {\n\tupdateStyles(toClass.getCSS());\n}\n","import {\n\ttype CommonPlugin,\n\ttype Parsed,\n\ttype ParsedChild,\n\tutils,\n} from 'ezal-markdown';\n\ninterface FoldParsed extends Parsed {\n\tchildren: [summary: ParsedChild, details: ParsedChild];\n}\n\nconst PATTERN_START = /(?<=^|\\n) {0,3}(\\+{3,}) {0,3}(\\S.*)\\n/;\n\nconst { $ } = utils;\n\nexport const fold: CommonPlugin<'block', FoldParsed> = {\n\tname: 'fold',\n\ttype: 'block',\n\torder: 0,\n\tpriority: 0,\n\tstart: PATTERN_START,\n\tparse(source, { md }) {\n\t\tconst matched = source.match(PATTERN_START);\n\t\tif (!matched) return;\n\t\tconst size = matched[1].length;\n\t\tconst summary = matched[2];\n\t\tconst pattern = new RegExp(`(?<=^|\\\\n) {0,3}\\\\+{${size}}\\\\s*(\\\\n|$)`);\n\t\tconst endMatched = source.match(pattern);\n\t\tconst end = endMatched?.index ?? Infinity;\n\t\tconst rawEnd = end + (endMatched?.[0].length ?? 0);\n\t\tconst raw = source.slice(0, rawEnd);\n\t\tconst details = raw.slice(matched[0].length, end);\n\t\treturn {\n\t\t\traw,\n\t\t\tchildren: [md(summary, 'inline'), md(details, 'block')],\n\t\t};\n\t},\n\trender({ children: [summary, details] }) {\n\t\treturn $('details', {\n\t\t\tclass: 'rounded',\n\t\t\thtml: [\n\t\t\t\t$('summary', { class: ['rounded', 'sticky'], html: summary.html }),\n\t\t\t\t$('div', { class: 'sticky-content', html: details.html }),\n\t\t\t],\n\t\t});\n\t},\n};\n","import {\n\ttype ASTPlugin,\n\ttype CommonPlugin,\n\tLinkNode,\n\ttype Parsed,\n\ttype ParsedChild,\n\tParsedNode,\n\ttype RendererPlugin,\n\tutils,\n} from 'ezal-markdown';\n\ninterface LinkParsed extends Parsed {\n\tid: string;\n\tlabel: string;\n}\n\ninterface SourceParsed extends Parsed {\n\tchildren: ParsedChild[];\n\tid: [label: string, id: string][];\n}\n\nconst { eachLine, $ } = utils;\n\nconst PATTERN_SOURCE_START = /(?<=^|\\n)\\[\\^.*?\\]:/;\nconst PATTERN_SOURCE_BEGIN = /^\\[(.*?)\\]:/;\nconst PATTERN_SOURCE_INDENT = /^(\\t| {1,4})/;\n\nconst render: RendererPlugin<'inline', LinkParsed> = {\n\tname: 'footnote',\n\ttype: 'inline',\n\trender({ id, label }, { counter }) {\n\t\tcounter.count(label);\n\t\treturn $(\n\t\t\t'sup',\n\t\t\t$('a', {\n\t\t\t\tclass: 'footnote',\n\t\t\t\tattr: { href: id },\n\t\t\t\tcontent: label,\n\t\t\t}),\n\t\t);\n\t},\n};\n\nconst ast: ASTPlugin<'inline', LinkNode> = {\n\tname: 'footnote-ast',\n\ttype: 'inline',\n\tphase: 'post',\n\tpriority: -1,\n\tparse(root) {\n\t\tfor (const child of root.entires().toArray()) {\n\t\t\tif (!(child instanceof LinkNode)) continue;\n\t\t\tif (child.label?.[0] !== '^') continue;\n\t\t\tif (child.raw?.length !== child.label.length + 2) continue;\n\t\t\tconst id = child.destination;\n\t\t\tconst label = child.raw.slice(2, -1);\n\t\t\tchild.before(\n\t\t\t\tnew ParsedNode('footnote', 'inline', { id, label } as LinkParsed),\n\t\t\t);\n\t\t\tchild.remove();\n\t\t}\n\t},\n\tverifyNode: (_): _ is LinkNode => false,\n\trender: () => '',\n};\n\nconst source: CommonPlugin<'block', SourceParsed> = {\n\tname: 'footnote-source',\n\ttype: 'block',\n\torder: 0,\n\tpriority: 0,\n\tstart: PATTERN_SOURCE_START,\n\tparse(source, { anchors, refMap, md }) {\n\t\tconst contents: string[] = [];\n\t\tconst id: [string, string][] = [];\n\t\tlet current = '';\n\t\tlet raw = '';\n\t\tlet indentState: boolean | null = null;\n\t\tfor (const [line] of eachLine(source)) {\n\t\t\tconst matched = line.match(PATTERN_SOURCE_BEGIN);\n\t\t\t// 首行\n\t\t\tif (matched) {\n\t\t\t\tif (matched[1][0] !== '^') break;\n\t\t\t\tif (raw) contents.push(current);\n\t\t\t\tconst label = matched[1].slice(1);\n\t\t\t\tconst hash = anchors.register(label);\n\t\t\t\tid.push([label, hash]);\n\t\t\t\trefMap.set(matched[1], { destination: `#${hash}` });\n\t\t\t\tcurrent = line.slice(matched[0].length);\n\t\t\t\traw += line;\n\t\t\t\tindentState = null;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// 懒续行\n\t\t\tconst indent = PATTERN_SOURCE_INDENT.test(line);\n\t\t\tconst empty = line.trim().length === 0;\n\t\t\t// 第二行设置缩进状态:若第二行为空则后续必须缩进\n\t\t\tif (indentState === null) indentState = indent || empty;\n\t\t\t// 若无需缩进或之前存在无缩进行,且当前行为空行则结束\n\t\t\tif (!indentState && empty) break;\n\t\t\t// 若需要缩进而为缩进则结束\n\t\t\tif (indentState && !indent) break;\n\t\t\t// 若不为空行且未缩进则设置为无缩进\n\t\t\tif (!(empty || indent)) indentState = false;\n\t\t\tcurrent += line;\n\t\t\traw += line;\n\t\t}\n\t\tif (id.length !== contents.length) contents.push(current);\n\t\tconst children = contents.map((content) =>\n\t\t\tmd(content, { skipParagraphWrapping: true, maxLevel: 'block' }),\n\t\t);\n\t\treturn { raw, id, children };\n\t},\n\trender({ id, children }, { counter }) {\n\t\tfor (const [label] of id) {\n\t\t\tcounter.count(label);\n\t\t}\n\t\tfor (const child of children) {\n\t\t\tcounter.count(child.raw);\n\t\t}\n\t\treturn $(\n\t\t\t'dl',\n\t\t\tchildren.flatMap((child, i) => [\n\t\t\t\t$('dt', { content: id[i][0], id: id[i][1] }),\n\t\t\t\t$('dd', child.html),\n\t\t\t]),\n\t\t);\n\t},\n};\n\nexport const footnote = { source, ast, render };\n","import { escapeHTML, type Page, URL } from 'ezal';\nimport {\n\ttype ASTPlugin,\n\tImageNode,\n\tParagraph,\n\ttype Parsed,\n\tParsedNode,\n\ttype RendererPlugin,\n\tutils,\n} from 'ezal-markdown';\nimport mime from 'mime-types';\nimport { getImageInfo, type ImageInfo } from '../image';\n\nconst { $ } = utils;\n\nfunction img(\n\tinfo: ImageInfo | null,\n\tsrc: string,\n\talt: string,\n\ttitle?: string,\n): string {\n\treturn $('img', {\n\t\tattr: {\n\t\t\tsrc: URL.for(src),\n\t\t\talt,\n\t\t\twidth: info?.metadata?.width,\n\t\t\theight: info?.metadata?.height,\n\t\t\tloading: 'lazy',\n\t\t\ttitle,\n\t\t},\n\t\tstyle: { $imgColor: info?.metadata?.color },\n\t});\n}\n\ninterface ImageParsed extends Parsed {\n\ttitle?: string;\n\talt: string;\n\turl: string;\n}\n\nfunction renderImage(\n\turl: string,\n\talt: string,\n\ttitle: string | undefined,\n\tpage: Page,\n): string {\n\tconst info = getImageInfo(URL.resolve(page.url, url));\n\tif (!info?.rule) return img(info, url, alt, title);\n\tconst html: string[] = info.rule.slice(0, -1).map((ext) =>\n\t\t$('source', {\n\t\t\tattr: { srcset: URL.extname(url, `.opt${ext}`), type: mime.lookup(ext) },\n\t\t}),\n\t);\n\thtml.push(img(info, URL.extname(url, info.rule.at(-1)!), alt, title));\n\treturn $('picture', html);\n}\n\nconst blockRender: RendererPlugin<'block', ImageParsed> = {\n\tname: 'image',\n\ttype: 'block',\n\trender({ title, url, alt }, { shared, counter }) {\n\t\tconst page = shared.page as any as Page;\n\t\tconst html: string[] = [renderImage(url, alt, title, page)];\n\t\thtml.push($('figcaption', { content: alt }));\n\t\tcounter.count(alt);\n\t\treturn $('figure', { class: 'image', html });\n\t},\n};\n\nconst block: ASTPlugin<'inline', ParsedNode> = {\n\tname: 'image-post',\n\ttype: 'inline',\n\tphase: 'post',\n\tpriority: -1,\n\tparse(root) {\n\t\tif (!(root instanceof Paragraph)) return;\n\t\tif (root.size !== 1) return;\n\t\tconst child = root.child(0);\n\t\tif (!(child instanceof ImageNode)) return;\n\t\tconst alt = child\n\t\t\t.entires()\n\t\t\t.map((node) => node.raw ?? '')\n\t\t\t.toArray()\n\t\t\t.join('');\n\t\tconst image = new ParsedNode('image', 'block', {\n\t\t\traw: child.raw ?? '',\n\t\t\ttitle: child.title,\n\t\t\talt: escapeHTML(alt),\n\t\t\turl: child.destination,\n\t\t} as ImageParsed);\n\t\troot.before(image);\n\t\troot.remove();\n\t},\n\tverifyNode: (_node): _node is ParsedNode => false,\n\trender: () => '',\n};\n\nconst inline: ASTPlugin<'inline', ImageNode> = {\n\tname: 'image',\n\ttype: 'inline',\n\tphase: 'post',\n\tpriority: 1,\n\tparse() {},\n\tverifyNode(node): node is ImageNode {\n\t\treturn node instanceof ImageNode;\n\t},\n\trender(node, { shared }) {\n\t\tconst page = shared.page as any as Page;\n\t\tconst { destination, title } = node;\n\t\tconst alt = escapeHTML(\n\t\t\tnode\n\t\t\t\t.entires()\n\t\t\t\t.map((node) => node.html)\n\t\t\t\t.toArray()\n\t\t\t\t.join(''),\n\t\t);\n\t\treturn renderImage(destination, alt, title, page);\n\t},\n};\n\nexport const image = { block, blockRender, inline };\n","import { type CommonPlugin, type Parsed, utils } from 'ezal-markdown';\n\ninterface KbdParsed extends Parsed {\n\tkey: string;\n}\n\nconst PATTERN = /{{\\S+?}}/;\n\nconst { $ } = utils;\n\nexport const kbd: CommonPlugin<'inline', KbdParsed> = {\n\tname: 'kbd',\n\ttype: 'inline',\n\torder: 0,\n\tpriority: 0,\n\tstart: PATTERN,\n\tparse(source) {\n\t\tconst matched = source.match(PATTERN);\n\t\tif (!matched) return;\n\t\treturn { raw: matched[0], key: matched[0].slice(2, -2) };\n\t},\n\trender({ key }, { counter }) {\n\t\tcounter.count(key);\n\t\treturn $('kbd', { content: key });\n\t},\n};\n","import { URL } from 'ezal';\nimport { type ASTPlugin, LinkNode, utils } from 'ezal-markdown';\n\nconst PATTERN_ABSOLUTE_LINK = /^[a-z][a-z0-9+.-]*:|^\\/\\//;\n\nconst { $ } = utils;\n\nexport const link: ASTPlugin<'inline', LinkNode> = {\n\tname: 'link',\n\ttype: 'inline',\n\tphase: 'post',\n\tpriority: 1,\n\tparse() {},\n\tverifyNode(node): node is LinkNode {\n\t\treturn node instanceof LinkNode;\n\t},\n\trender(node) {\n\t\tconst html = [...node.entires().map((node) => node.html)];\n\t\tconst target = PATTERN_ABSOLUTE_LINK.test(node.destination)\n\t\t\t? '_blank'\n\t\t\t: undefined;\n\t\treturn $('a', {\n\t\t\tattr: { href: URL.for(node.destination), target, title: node.title },\n\t\t\thtml,\n\t\t});\n\t},\n};\n","import { URL } from 'ezal';\nimport { type CommonPlugin, type Parsed, utils } from 'ezal-markdown';\n\ninterface Link {\n\thref: string;\n\ticon?: string;\n\ttitle: string;\n\tsubtitle?: string;\n}\n\ninterface LinksParsed extends Parsed {\n\tlinks: Link[];\n}\n\nconst PATTERN_ALL = /(?<=^|\\n)@@\\n.*?\\n@@(\\n|$)/s;\nconst PATTERN_EACH = /(?<=^|\\n)@ ?([^@\\n].*\\n){2,3}/g;\nconst PATTERN_WHITESPACE = /\\s+/;\n\nconst { $ } = utils;\n\nexport const links: CommonPlugin<'block', LinksParsed> = {\n\tname: 'links',\n\ttype: 'block',\n\torder: 0,\n\tpriority: 0,\n\tstart: PATTERN_ALL,\n\tparse(source) {\n\t\tconst matched = source.match(PATTERN_ALL);\n\t\tif (!matched) return;\n\t\tconst raw = matched[0];\n\t\tconst links = [\n\t\t\t...raw.matchAll(PATTERN_EACH).map<Link>((matched) => {\n\t\t\t\tconst lines = matched[0].split('\\n');\n\t\t\t\tconst args = lines[0].slice(1).trim().split(PATTERN_WHITESPACE);\n\t\t\t\treturn {\n\t\t\t\t\thref: args[0],\n\t\t\t\t\ticon: args[1],\n\t\t\t\t\ttitle: lines[1],\n\t\t\t\t\tsubtitle: lines[2],\n\t\t\t\t};\n\t\t\t}),\n\t\t];\n\t\treturn { raw, links };\n\t},\n\trender({ links }, { counter }) {\n\t\tconst html = links.map<string>(({ href, icon, title, subtitle }) => {\n\t\t\tconst html: string[] = [$('i', { class: ['icon-link'] })];\n\t\t\tif (icon) {\n\t\t\t\thtml.push(\n\t\t\t\t\t$('img', { class: 'rounded', attr: { src: URL.for(icon), alt: title } }),\n\t\t\t\t);\n\t\t\t}\n\t\t\thtml.push($('div', { class: 'link-title', content: title }));\n\t\t\tcounter.count(title);\n\t\t\tif (subtitle) {\n\t\t\t\thtml.push($('div', { content: subtitle }));\n\t\t\t\tcounter.count(subtitle);\n\t\t\t}\n\t\t\treturn $('a', { class: 'rounded', html, attr: { href: URL.for(href) } });\n\t\t});\n\t\treturn $('div', { class: 'links', html });\n\t},\n};\n","import {\n\ttype CommonPlugin,\n\ttype Parsed,\n\ttype ParsedChild,\n\tutils,\n} from 'ezal-markdown';\n\ninterface NoteParsed extends Parsed {\n\ttype: string;\n\ttitle: string;\n\tchildren: ParsedChild;\n}\n\nconst PATTERN_START = /(?<=^|\\n) {0,3}(!{3,}) ?(info|tip|warn|danger)(.*)\\n/;\n\nconst { $ } = utils;\n\nconst NOTE_TITLE: Record<string, string> = {\n\tinfo: '注意',\n\ttip: '提示',\n\twarn: '警告',\n\tdanger: '危险',\n};\n\nexport const note: CommonPlugin<'block', NoteParsed> = {\n\tname: 'note',\n\ttype: 'block',\n\torder: 0,\n\tpriority: 0,\n\tstart: PATTERN_START,\n\tparse(source, { md }) {\n\t\tconst matched = source.match(PATTERN_START);\n\t\tif (!matched) return;\n\t\tconst size = matched[1].length;\n\t\tconst type = matched[2];\n\t\tlet title = matched[3]?.trim();\n\t\tif (!title) title = NOTE_TITLE[type];\n\t\tconst pattern = new RegExp(`(?<=^|\\\\n) {0,3}!{${size}}\\\\s*(\\\\n|$)`);\n\t\tconst endMatched = source.match(pattern);\n\t\tconst end = endMatched?.index ?? Infinity;\n\t\tconst rawEnd = end + (endMatched?.[0].length ?? 0);\n\t\tconst raw = source.slice(0, rawEnd);\n\t\tconst content = raw.slice(matched[0].length, end);\n\t\treturn { raw, type, title, children: md(content, 'block') };\n\t},\n\trender({ type, title, children }) {\n\t\treturn $('div', {\n\t\t\tclass: ['note', `note-${type}`],\n\t\t\thtml: [$('p', [$('i', { class: `icon-${type}` }), title]), children.html],\n\t\t});\n\t},\n};\n","import { plugins, utils } from 'ezal-markdown';\n\nconst { $ } = utils;\n\nconst origin = plugins.table();\n\nexport const table: typeof origin = {\n\t...origin,\n\trender(source, context, options) {\n\t\treturn $('div', {\n\t\t\tclass: ['table', 'rounded'],\n\t\t\tattr: { tabindex: '0' },\n\t\t\thtml: origin.render(source, context, options) as string,\n\t\t});\n\t},\n};\n","import {\n\ttype CommonPlugin,\n\ttype Parsed,\n\ttype ParsedChild,\n\tutils,\n} from 'ezal-markdown';\n\ninterface TabsParsed extends Parsed {\n\tchildren: [tab: ParsedChild, content: ParsedChild][];\n\tid: string[];\n}\n\nconst PATTERN_START = /(?<=^|\\n) {0,3}(:{3,}) {0,3}\\S/;\n\nconst { $ } = utils;\n\nexport const tabs: CommonPlugin<'block', TabsParsed, number> = {\n\tname: 'tabs',\n\ttype: 'block',\n\torder: 0,\n\tpriority: 0,\n\tstart: PATTERN_START,\n\tparse(source, { anchors, md }) {\n\t\tconst size = source.match(PATTERN_START)?.[1].length ?? 0;\n\t\tif (!size) return;\n\n\t\tconst pattern = new RegExp(`(?<=^|\\\\n) {0,3}:{${size}}(.*)(\\\\n|$)`);\n\t\tconst children: TabsParsed['children'] = [];\n\t\tconst id: TabsParsed['id'] = [];\n\n\t\tlet matched = source.match(pattern);\n\t\tlet offset = 0;\n\t\twhile (matched) {\n\t\t\toffset += matched[0].length;\n\t\t\tif (matched[1].trim().length === 0) break;\n\t\t\tconst tab = md(matched[1], 'inline');\n\t\t\tmatched = source.slice(offset).match(pattern);\n\t\t\tconst next = (matched?.index ?? Infinity) + offset;\n\t\t\tconst content = md(source.slice(offset, next), 'block');\n\t\t\toffset = next;\n\t\t\tid.push(anchors.register('tab'));\n\t\t\tchildren.push([tab, content]);\n\t\t}\n\n\t\tif (children.length === 0) return;\n\n\t\treturn { raw: source.slice(0, offset), children, id };\n\t},\n\trender({ children, id }, context) {\n\t\tconst name = `tabs-${context.self}`;\n\t\tcontext.self++;\n\t\tconst nav = children.map(([tab], i) =>\n\t\t\t$('label', {\n\t\t\t\tattr: { for: id[i] },\n\t\t\t\thtml: [\n\t\t\t\t\t$('input', { attr: { type: 'radio', name, checked: i === 0 }, id: id[i] }),\n\t\t\t\t\ttab.html,\n\t\t\t\t],\n\t\t\t}),\n\t\t);\n\t\tconst content = children.map(([_, content], i) =>\n\t\t\t$('div', { class: i === 0 ? 'active' : undefined, html: content.html }),\n\t\t);\n\t\treturn $('div', {\n\t\t\tclass: ['tabs', 'rounded'],\n\t\t\thtml: [\n\t\t\t\t$('div', { class: ['tab-nav', 'rounded', 'sticky'], html: nav }),\n\t\t\t\t$('div', { class: ['tab-content', 'sticky-content'], html: content }),\n\t\t\t],\n\t\t});\n\t},\n\tcontext: () => 0,\n};\n","import type { CommonPlugin, Parsed, PluginLogger } from 'ezal-markdown';\nimport katex, { type StrictFunction } from 'katex';\n\nconst PATTERN_INLINE = /(?<=\\s|\\W|^)(?<!\\$)(\\$\\$?)(.+?)(\\1)(?!\\$)(?=\\s|\\W|$)/;\nconst PATTERN_BLOCK = /(?<=^|\\n) {0,3}\\$\\$.*?\\$\\$\\s*(\\n|$)/s;\n\nconst katexErrorHandler =\n\t(logger: PluginLogger): StrictFunction =>\n\t(errorCode, errorMsg, token) => {\n\t\tswitch (errorCode) {\n\t\t\tcase 'unknownSymbol':\n\t\t\tcase 'unicodeTextInMathMode':\n\t\t\tcase 'mathVsTextUnits':\n\t\t\tcase 'newLineInDisplayMode':\n\t\t\tcase 'htmlExtension':\n\t\t\t\tlogger.warn(`${errorCode}: ${errorMsg}`, token);\n\t\t\t\tbreak;\n\t\t\tcase 'commentAtEnd':\n\t\t\t\tlogger.error(`${errorCode}: ${errorMsg}`, token);\n\t\t\t\tbreak;\n\t\t}\n\t\treturn false;\n\t};\n\ninterface TexParsed extends Parsed {\n\ttex: string;\n}\n\nconst inline: CommonPlugin<'inline', TexParsed> = {\n\tname: 'tex',\n\ttype: 'inline',\n\torder: 0,\n\tpriority: 0,\n\tstart: PATTERN_INLINE,\n\tparse(source) {\n\t\tconst matched = source.match(PATTERN_INLINE);\n\t\tif (!matched) return;\n\t\tconst raw = matched[0];\n\t\tconst tex = matched[2];\n\t\treturn { raw, tex };\n\t},\n\trender({ tex }, { logger, shared, counter }) {\n\t\tshared.tex = true;\n\t\tcounter.count(tex);\n\t\treturn katex.renderToString(tex, {\n\t\t\toutput: 'html',\n\t\t\tthrowOnError: false,\n\t\t\tstrict: katexErrorHandler(logger),\n\t\t});\n\t},\n};\n\nconst block: CommonPlugin<'block', TexParsed> = {\n\tname: 'tex',\n\ttype: 'block',\n\torder: 0,\n\tpriority: 0,\n\tstart: PATTERN_BLOCK,\n\tparse(source) {\n\t\tconst matched = source.match(PATTERN_BLOCK);\n\t\tif (!matched) return;\n\t\tconst raw = matched[0];\n\t\tconst start = raw.indexOf('$$');\n\t\tconst end = raw.lastIndexOf('$$');\n\t\tconst tex = raw.slice(start + 2, end).trim();\n\t\treturn { raw, tex };\n\t},\n\trender({ tex }, { logger, shared, counter }) {\n\t\tshared.tex = true;\n\t\tcounter.count(tex);\n\t\treturn katex.renderToString(tex, {\n\t\t\tdisplayMode: true,\n\t\t\toutput: 'html',\n\t\t\tthrowOnError: false,\n\t\t\tstrict: katexErrorHandler(logger),\n\t\t});\n\t},\n};\n\nexport const tex = { inline, block };\n","import { fs, Logger, type PageHandler } from 'ezal';\nimport {\n\ttype CommonPlugin,\n\tEzalMarkdown,\n\textractFrontmatter,\n\tplugins,\n} from 'ezal-markdown';\nimport { getThemeConfig } from '../config';\nimport { codeblock } from './codeblock';\nimport { fold } from './fold';\nimport { footnote } from './footnote';\nimport { image } from './image';\nimport { kbd } from './kbd';\nimport { link } from './link';\nimport { links } from './links';\nimport { note } from './note';\nimport { table } from './table';\nimport { tabs } from './tabs';\nimport { tex } from './tex';\n\nconst logger = new Logger('markdown');\n\nconst renderer = new EzalMarkdown();\nrenderer.logger = {\n\tdebug(data) {\n\t\tlogger.debug(`[${data.name}]`, data.message, data.errObj);\n\t},\n\tinfo(data) {\n\t\tlogger.log(`[${data.name}]`, data.message, data.errObj);\n\t},\n\twarn(data) {\n\t\t// HACK: 忽略因脚注引起的警告\n\t\tif (\n\t\t\tdata.name === 'link-reference-define' &&\n\t\t\tdata.message.includes('label ^')\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tlogger.warn(`[${data.name}]`, data.message, data.errObj);\n\t},\n\terror(data) {\n\t\tlogger.error(`[${data.name}]`, data.message, data.errObj);\n\t},\n};\n\nconst setext: CommonPlugin<'block'> = {\n\tname: 'setext-heading',\n\ttype: 'block',\n\torder: 0,\n\tpriority: 0,\n\tstart: () => null,\n\tparse: () => null,\n\trender: () => '',\n};\n\nexport async function markdownPageHandler(): Promise<PageHandler> {\n\trenderer.set(\n\t\tplugins.heading({ shiftLevels: true }),\n\t\timage,\n\t\ttable,\n\t\tawait codeblock(),\n\t\tfootnote,\n\t\ttex,\n\t\ttabs,\n\t\tnote,\n\t\tfold,\n\t\tkbd,\n\t\tlinks,\n\t\tsetext,\n\t\tlink,\n\t);\n\treturn {\n\t\texts: '.md',\n\t\tasync parser(src) {\n\t\t\tconst file = await fs.readFile(src);\n\t\t\tif (file instanceof Error) return file;\n\t\t\tconst frontmatter = await extractFrontmatter(file);\n\t\t\tlet data = frontmatter?.data as Record<string, any>;\n\t\t\tif (typeof data !== 'object') data = {};\n\t\t\tconst content = file.slice(frontmatter?.raw.length ?? 0);\n\t\t\treturn { content, data };\n\t\t},\n\t\tasync renderer(content, page) {\n\t\t\tconst config = getThemeConfig();\n\t\t\tconst result = await renderer.renderHTML(content, {\n\t\t\t\tlineBreak: config.markdown?.lineBreak,\n\t\t\t\tshared: { page } as any,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\thtml: result.html,\n\t\t\t\tdata: result.context,\n\t\t\t};\n\t\t},\n\t};\n}\n","import { VirtualPage } from 'ezal';\n\nexport function init404Page() {\n\tnew VirtualPage({ id: '404', src: '/404.html', layout: '404' });\n}\n","import { Article, VirtualPage } from 'ezal';\nimport type { ArchivePage, ArchivePageData } from '../../layouts/context';\nimport { compareByDate } from '../utils';\n\nlet indexPage: ArchivePage;\nconst years = new Map<number, number>();\n\nfunction getArticles(year: number): Article[] {\n\treturn Article.getAll()\n\t\t.filter((article) => article.date.year === year)\n\t\t.toSorted(compareByDate);\n}\n\nfunction createIndex() {\n\tconst data: ArchivePageData = { years, getArticles };\n\tindexPage = new VirtualPage({\n\t\tid: 'archive',\n\t\tsrc: '/archive/',\n\t\tlayout: 'archive',\n\t\ttitle: '归档',\n\t\tdata,\n\t}) as ArchivePage;\n}\n\nlet scanned = false;\nexport function updateArchivePage(_any?: any) {\n\tif (!scanned && _any) return;\n\tscanned = true;\n\tif (!indexPage) createIndex();\n\tconst newYears = new Map<number, number>();\n\tfor (const article of Article.getAll()) {\n\t\tconst year = article.date.year;\n\t\tlet count = newYears.get(year);\n\t\tif (count === undefined) count = 0;\n\t\tcount++;\n\t\tnewYears.set(year, count);\n\t}\n\tyears.clear();\n\tfor (const [year, count] of newYears) {\n\t\tyears.set(year, count);\n\t}\n\tindexPage.invalidated();\n}\n","import { Category, VirtualPage } from 'ezal';\nimport type { CategoryPage, CategoryPageData } from '../../layouts/context';\n\nconst categories = new Map<Category, CategoryPage>();\n\nfunction createPage(category: Category): CategoryPage {\n\tconst id = `category/${category.path.join('/')}`;\n\tconst data: CategoryPageData = { category };\n\treturn new VirtualPage({\n\t\tid,\n\t\tsrc: `/${id}/`,\n\t\ttitle: `分类:${category.name}`,\n\t\tlayout: 'category',\n\t\tdata,\n\t}) as CategoryPage;\n}\n\nlet scanned = false;\nexport function updateCategoryPage(_any?: any) {\n\tif (!scanned && _any) return;\n\tscanned = true;\n\tfor (const [category, page] of categories.entries().toArray()) {\n\t\tif (!category.destroyed) continue;\n\t\tpage.destroy();\n\t\tcategories.delete(category);\n\t}\n\tfor (const category of Category.getAll()) {\n\t\tif (categories.has(category)) continue;\n\t\tcategories.set(category, createPage(category));\n\t}\n}\n","import { Article, VirtualPage } from 'ezal';\nimport type { HomePage, HomePageData } from '../../layouts/context';\nimport { getThemeConfig } from '../config';\nimport { compareByDate } from '../utils';\n\nconst pages: HomePage[] = [];\n\nfunction getArticles(index: number): Article[] {\n\tconst pre = getThemeConfig().home?.articlesPrePage ?? 10;\n\tconst offset = index * pre;\n\treturn Article.getAll()\n\t\t.toSorted(compareByDate)\n\t\t.slice(offset, offset + pre);\n}\n\nfunction getPages() {\n\treturn pages;\n}\n\nfunction createPage(index: number): HomePage {\n\tconst i = String(index + 1);\n\tconst data: HomePageData = { index, getPages, getArticles };\n\treturn new VirtualPage({\n\t\tid: index ? `${i}/` : '',\n\t\tsrc: `/${index ? `${i}/` : ''}`,\n\t\tlayout: 'home',\n\t\tdata,\n\t}) as HomePage;\n}\n\nlet scanned = false;\nexport function updateHomePage(article?: Article) {\n\tif (!scanned && article) return;\n\tscanned = true;\n\tconst pre = getThemeConfig().home?.articlesPrePage ?? 10;\n\tconst count = Math.ceil(Math.max(Article.getAll().length / pre, 1));\n\tif (count > pages.length) {\n\t\tfor (let i = pages.length; i < count; i++) {\n\t\t\tpages.push(createPage(i));\n\t\t}\n\t} else if (count < pages.length) {\n\t\tfor (const page of pages.splice(count)) {\n\t\t\tpage.destroy();\n\t\t}\n\t}\n\tfor (const page of pages) {\n\t\tpage.invalidated();\n\t}\n}\n","import { Tag, VirtualPage } from 'ezal';\nimport type { TagPage, TagPageData } from '../../layouts/context';\n\nconst tags = new Map<Tag, TagPage>();\n\nfunction createPage(tag: Tag): TagPage {\n\tconst id = `tag/${tag.name}`;\n\tconst data: TagPageData = { tag };\n\treturn new VirtualPage({\n\t\tid,\n\t\tsrc: `/${id}/`,\n\t\ttitle: `标签:${tag.name}`,\n\t\tlayout: 'tag',\n\t\tdata,\n\t}) as TagPage;\n}\n\nlet scanned = false;\nexport function updateTagPage(_any?: any) {\n\tif (!scanned && _any) return;\n\tscanned = true;\n\tfor (const [tag, page] of tags.entries().toArray()) {\n\t\tif (!tag.destroyed) continue;\n\t\tpage.destroy();\n\t\ttags.delete(tag);\n\t}\n\tfor (const tag of Tag.getAll()) {\n\t\tif (tags.has(tag)) continue;\n\t\ttags.set(tag, createPage(tag));\n\t}\n}\n","import {\n\tArticle,\n\tgetConfig,\n\tgetMode,\n\tLogger,\n\tPage,\n\ttype PromiseOr,\n\tVirtualAssets,\n} from 'ezal';\nimport type { RouteContent } from 'ezal/dist/route';\nimport type * as pagefind from 'pagefind';\n\nconst logger = new Logger('theme:index');\n\nlet index: pagefind.PagefindIndex;\nconst assets = new Map<string, PagefindIndex>();\n\nclass PagefindIndex extends VirtualAssets {\n\tbuffer: Buffer;\n\tconstructor(url: string, buffer: Buffer) {\n\t\tsuper(url);\n\t\tthis.buffer = buffer;\n\t}\n\tbuild(): PromiseOr<RouteContent> {\n\t\treturn this.buffer;\n\t}\n\tprotected onDependenciesChanged() {}\n}\n\n/** 重建索引文件虚拟资源 */\nasync function rebuildIndexFile() {\n\tif (!index) return;\n\tconst { errors, files } = await index.getFiles();\n\tif (errors.length > 0) {\n\t\tif (getMode() === 'build') logger.fatal(errors);\n\t\telse logger.error(errors);\n\t\treturn;\n\t}\n\tconst fileMap = new Map(\n\t\tfiles.map(({ path, content }) => [path, Buffer.from(content)]),\n\t);\n\tfor (const [path, asset] of assets.entries().toArray()) {\n\t\tif (fileMap.has(path)) continue;\n\t\tasset.destroy();\n\t\tassets.delete(path);\n\t}\n\tfor (const [path, buffer] of fileMap) {\n\t\tlet asset = assets.get(path);\n\t\tif (asset) {\n\t\t\tasset.buffer = buffer;\n\t\t\tasset.invalidated();\n\t\t\tcontinue;\n\t\t}\n\t\tasset = new PagefindIndex(path, buffer);\n\t\tassets.set(path, asset);\n\t}\n}\n\n/**\n * 添加页面\n * @description 构建模式下需启用强制才能添加索引\n */\nexport async function addPage(page: Page, force?: boolean): Promise<string[]> {\n\tif (!index) return [];\n\tif (getMode() === 'build' && !force) return [];\n\n\tconst allowIndex = page.data?.index;\n\tif (page instanceof Article) {\n\t\tif (allowIndex === false) return [];\n\t} else if (!allowIndex) return [];\n\n\tconst { errors } = await index.addCustomRecord({\n\t\turl: page.url,\n\t\tcontent: page.content ?? page.markdownContent ?? '',\n\t\tlanguage: getConfig().site.language,\n\t\tmeta: { title: page.title },\n\t});\n\tif (errors.length > 0) logger.error(errors);\n\tif (!force) await rebuildIndexFile();\n\treturn errors;\n}\n\n/** 创建所有页面索引 */\nasync function buildAllIndex(): Promise<string[]> {\n\tconst errors: string[] = [];\n\tfor (const article of Article.getAll()) {\n\t\terrors.push(...(await addPage(article, true)));\n\t}\n\tfor (const page of Page.getAll()) {\n\t\terrors.push(...(await addPage(page, true)));\n\t}\n\treturn errors;\n}\n\n/**\n * 清除并重建索引\n * @description 构建模式下无效\n */\nexport async function rebuildPagefind() {\n\tif (!index) return;\n\tif (getMode() === 'build') return;\n\tawait index.deleteIndex();\n\tconst pagefind = await import('pagefind');\n\tconst response = await pagefind.createIndex();\n\tif (!response.index) throw response.errors;\n\tindex = response.index;\n\tawait buildAllIndex();\n\tawait rebuildIndexFile();\n}\n\n/** 构建 Pagefind */\nexport async function buildPagefind() {\n\tif (!index) throw new Error('Pagefind not initialized');\n\tawait buildAllIndex();\n\tawait rebuildIndexFile();\n}\n\n/**\n * 初始化 PageFind\n * @description 构建模式下不会构建索引\n */\nexport async function initPagefind() {\n\tif (index) return;\n\tconst pagefind = await import('pagefind');\n\tconst response = await pagefind.createIndex();\n\tif (!response.index) throw response.errors;\n\tindex = response.index;\n\tif (getMode() === 'build') return;\n\tawait rebuildPagefind();\n}\n\n/** 停止 PageFind */\nexport async function stopPagefind() {\n\tconst pagefind = await import('pagefind');\n\tawait pagefind.close();\n}\n","import { Article, getConfig, Page, URL, VirtualAssets } from 'ezal';\nimport { SitemapStream } from 'sitemap';\nimport { getThemeConfig } from './config';\n\nfunction getInfo(page: Page): {\n\turl: string;\n\tchangefreq: string;\n\timg?: string;\n} {\n\tlet img = page.data?.cover;\n\tif (img) img = URL.resolve(page.url, img);\n\treturn { url: page.url, changefreq: 'weekly', img };\n}\n\nclass Sitemap extends VirtualAssets {\n\tconstructor() {\n\t\tsuper('/sitemap.xml');\n\t}\n\tbuild() {\n\t\tconst { site } = getConfig();\n\t\tconst stream = new SitemapStream({ hostname: site.domain });\n\n\t\tstream.write({ url: '/' });\n\t\tconst pre = getThemeConfig().home?.articlesPrePage ?? 10;\n\t\tconst count = Math.ceil(Math.max(Article.getAll().length / pre, 1));\n\t\tfor (let i = 2; i <= count; i++) stream.write({ url: `/${i}/` });\n\n\t\tfor (const article of Article.getAll()) {\n\t\t\tif (article.data?.sitemap === false) continue;\n\t\t\tstream.write(getInfo(article));\n\t\t}\n\n\t\tfor (const page of Page.getAll()) {\n\t\t\tif (!page.data?.sitemap) continue;\n\t\t\tstream.write(getInfo(page));\n\t\t}\n\n\t\tstream.end();\n\n\t\treturn stream;\n\t}\n\tprotected onDependenciesChanged() {}\n}\n\nlet asset: Sitemap;\n\nexport function initSitemap() {\n\tasset = new Sitemap();\n}\n\nexport function updateSitemap() {\n\tasset?.invalidated();\n}\n","import path from 'node:path';\nimport esbuild from 'esbuild';\nimport { getMode, type TransformRule } from 'ezal';\n\nexport const scriptTransformRule: TransformRule = {\n\tfrom: '.ts',\n\tto: '.js',\n\tasync transformer(src: string) {\n\t\tconst buildMode = getMode() === 'build';\n\t\tconst {\n\t\t\toutputFiles,\n\t\t\tmetafile: { inputs },\n\t\t} = await esbuild.build({\n\t\t\t// Load\n\t\t\tentryPoints: [src],\n\t\t\tloader: { '.ts': 'ts' },\n\t\t\texternal: ['../pagefind.js'],\n\t\t\t// Output\n\t\t\tbundle: true,\n\t\t\tplatform: 'browser',\n\t\t\tformat: 'iife',\n\t\t\ttarget: 'es2024',\n\t\t\twrite: false,\n\t\t\tmetafile: true,\n\t\t\tsourcemap: buildMode ? false : 'inline',\n\t\t\t// Other\n\t\t\ttreeShaking: buildMode,\n\t\t\tminify: buildMode,\n\t\t});\n\t\tconst cwd = process.cwd();\n\t\tconst result = outputFiles[0].text;\n\t\tconst dependencies = Object.keys(inputs).map((src) => path.join(cwd, src));\n\t\treturn { result, dependencies };\n\t},\n};\n","import path from 'node:path';\nimport CleanCSS from 'clean-css';\nimport { fs, getMode, normalizeError, type TransformRule } from 'ezal';\nimport stylus from 'stylus';\nimport { getThemeConfig, type LinkPageStyles } from '../config';\n\nconst STYLE_CONFIGS: Record<string, () => any> = {\n\t'color.light': () => getThemeConfig().color?.light,\n\t'color.dark': () => getThemeConfig().color?.dark,\n\twaline: () => !!getThemeConfig().waline,\n};\n\nfunction config({ val }: { val: string }) {\n\tif (val in STYLE_CONFIGS) return STYLE_CONFIGS[val]();\n}\n\nfunction linksStyle({ val }: { val: LinkPageStyles }): boolean {\n\tconst styles = getThemeConfig().linkPageStyles;\n\tif (!styles) return true;\n\treturn styles.includes(val);\n}\n\nconst cleaner = new CleanCSS();\n\nexport const styleTransformRule: TransformRule = {\n\tfrom: '.styl',\n\tto: '.css',\n\tasync transformer(src: string) {\n\t\tconst file = await fs.readFile(src);\n\t\tif (file instanceof Error) return file;\n\t\ttry {\n\t\t\tconst renderer = stylus(file, {\n\t\t\t\tpaths: [path.join(src, '..')],\n\t\t\t\tfilename: path.basename(src),\n\t\t\t\tfunctions: { config, linksStyle },\n\t\t\t\t// @ts-expect-error\n\t\t\t\t'include css': true,\n\t\t\t});\n\t\t\tconst dependencies = renderer.deps().map((dep) => {\n\t\t\t\tif (!dep.startsWith('//?/')) return dep;\n\t\t\t\treturn path.normalize(dep.slice(4));\n\t\t\t});\n\t\t\tlet result = renderer.render();\n\t\t\tif (getMode() === 'build') result = cleaner.minify(result).styles;\n\t\t\treturn { result, dependencies };\n\t\t} catch (error) {\n\t\t\treturn normalizeError(error);\n\t\t}\n\t},\n};\n","import path from 'node:path';\nimport type { ThemeConfig as EzalThemeConfig } from 'ezal';\nimport { setThemeConfig, type ThemeConfig } from './config';\nimport { initFeed, updateFeedCategory, updateFeedItem } from './feed';\nimport { imageAddHook, imageRemoveHook, imageUpdateHook } from './image';\nimport { imageDB } from './image/db';\nimport { exeIndexNow } from './index-now';\nimport { layoutConfig } from './layout';\nimport { markdownPageHandler } from './markdown';\nimport { setupCodeblockStyle } from './markdown/codeblock';\nimport { initCodeblockStyle } from './markdown/codeblock/style';\nimport { init404Page } from './page/404';\nimport { updateArchivePage } from './page/archive';\nimport { updateCategoryPage } from './page/category';\nimport { updateHomePage } from './page/home';\nimport { updateTagPage } from './page/tag';\nimport {\n\taddPage,\n\tbuildPagefind,\n\tinitPagefind,\n\trebuildPagefind,\n\tstopPagefind,\n} from './pagefind';\nimport { initSitemap, updateSitemap } from './sitemap';\nimport { scriptTransformRule } from './transform/script';\nimport { styleTransformRule } from './transform/stylus';\n\nexport async function theme(config?: ThemeConfig): Promise<EzalThemeConfig> {\n\tsetThemeConfig(config);\n\timageDB.init();\n\treturn {\n\t\tassetsRoot: path.join(__dirname, '../assets'),\n\t\ttransformRules: [styleTransformRule, scriptTransformRule],\n\t\tlayout: layoutConfig,\n\t\tpageHandlers: [await markdownPageHandler()],\n\t\thooks: {\n\t\t\t'config:after': [initCodeblockStyle],\n\t\t\t'scan:after': [\n\t\t\t\tupdateHomePage,\n\t\t\t\tupdateArchivePage,\n\t\t\t\tupdateCategoryPage,\n\t\t\t\tupdateTagPage,\n\t\t\t\tinit404Page,\n\t\t\t\tinitPagefind,\n\t\t\t\tinitSitemap,\n\t\t\t\tinitFeed,\n\t\t\t],\n\t\t\t'asset:add': [imageAddHook],\n\t\t\t'asset:update': [imageUpdateHook],\n\t\t\t'asset:remove': [imageRemoveHook],\n\t\t\t'build:before:assets-virtual': [\n\t\t\t\tsetupCodeblockStyle,\n\t\t\t\tbuildPagefind,\n\t\t\t\tupdateSitemap,\n\t\t\t],\n\t\t\t'build:after': [stopPagefind, exeIndexNow],\n\t\t\t'article:add': [updateHomePage, updateArchivePage],\n\t\t\t'article:update': [\n\t\t\t\tupdateHomePage,\n\t\t\t\tupdateArchivePage,\n\t\t\t\taddPage,\n\t\t\t\tupdateSitemap,\n\t\t\t\tupdateFeedItem,\n\t\t\t],\n\t\t\t'article:remove': [\n\t\t\t\tupdateHomePage,\n\t\t\t\tupdateArchivePage,\n\t\t\t\trebuildPagefind,\n\t\t\t\tupdateSitemap,\n\t\t\t\tupdateFeedItem,\n\t\t\t],\n\t\t\t'article:build:after': [addPage, updateFeedItem],\n\t\t\t'page:update': [addPage, updateSitemap],\n\t\t\t'page:remove': [rebuildPagefind, updateSitemap],\n\t\t\t'page:build:after': [addPage],\n\t\t\t'category:add': [updateCategoryPage],\n\t\t\t'category:update': [updateCategoryPage, updateFeedCategory],\n\t\t\t'category:remove': [updateCategoryPage, updateFeedCategory],\n\t\t\t'tag:add': [updateTagPage],\n\t\t\t'tag:update': [updateTagPage],\n\t\t\t'tag:remove': [updateTagPage],\n\t\t\t'preview:stop': [stopPagefind],\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2IA,IAAIA;AAEJ,SAAgB,eAAe,KAAmB;AACjD,YAAS,OAAO,EAAE;;AAGnB,SAAgB,iBAAiB;AAChC,QAAOC;;;;;AChJR,SAAgB,cAAc,GAAY,GAAoB;AAC7D,QAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK;;;;;ACE1C,MAAM,gBAAgB;CACrB,KAAK;CACL,MAAM;CACN,MAAM;CACN;AAED,IAAIC;AACJ,IAAIC;AACJ,IAAIC;AAEJ,IAAM,YAAN,cAAwBC,mBAAc;CACrC;CACA,YAAY,MAA+B;AAC1C,QAAM,cAAc,MAAM;AAC1B,QAAKC,OAAQ;;CAEd,QAAQ;AACP,UAAQ,MAAKA,MAAb;GACC,KAAK,MACJ,QAAOC,OAAK,MAAM;GACnB,KAAK,OACJ,QAAOA,OAAK,OAAO;GACpB,KAAK,OACJ,QAAOA,OAAK,OAAO;GACpB,QACC,QAAO;;;CAGV,AAAU,wBAAwB;;AAGnC,SAAgB,W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pC,WAAOC,kBAAK,UAAU,IAAI,MAAM,EAAE,CAAC;KAClC;GACF,IAAI,SAASD,WAAS,QAAQ;AAC9B,0BAAa,KAAK,QAAS,UAAS,QAAQ,OAAO,OAAO,CAAC;AAC3D,UAAO;IAAE;IAAQ;IAAc;WACvB,OAAO;AACf,mCAAsB,MAAM;;;CAG9B;;;;ACtBD,eAAsB,MAAM,UAAgD;AAC3E,gBAAeE,SAAO;AACtB,SAAQ,MAAM;AACd,QAAO;EACN,YAAYC,kBAAK,KAAK,WAAW,YAAY;EAC7C,gBAAgB,CAAC,oBAAoB,oBAAoB;EACzD,QAAQ;EACR,cAAc,CAAC,MAAM,qBAAqB,CAAC;EAC3C,OAAO;GACN,gBAAgB,CAAC,mBAAmB;GACpC,cAAc;IACb;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACD,aAAa,CAAC,aAAa;GAC3B,gBAAgB,CAAC,gBAAgB;GACjC,gBAAgB,CAAC,gBAAgB;GACjC,+BAA+B;IAC9B;IACA;IACA;IACA;GACD,eAAe,CAAC,cAAc,YAAY;GAC1C,eAAe,CAAC,gBAAgB,kBAAkB;GAClD,kBAAkB;IACjB;IACA;IACA;IACA;IACA;IACA;GACD,kBAAkB;IACjB;IACA;IACA;IACA;IACA;IACA;GACD,uBAAuB,CAAC,SAAS,eAAe;GAChD,eAAe,CAAC,SAAS,cAAc;GACvC,eAAe,CAAC,iBAAiB,cAAc;GAC/C,oBAAoB,CAAC,QAAQ;GAC7B,gBAAgB,CAAC,mBAAmB;GACpC,mBAAmB,CAAC,oBAAoB,mBAAmB;GAC3D,mBAAmB,CAAC,oBAAoB,mBAAmB;GAC3D,WAAW,CAAC,cAAc;GAC1B,cAAc,CAAC,cAAc;GAC7B,cAAc,CAAC,cAAc;GAC7B,gBAAgB,CAAC,aAAa;GAC9B;EACD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["config: ThemeConfig","config","author: Author","feed: Feed","assets: { rss: FeedAsset; atom: FeedAsset; feed: FeedAsset }","VirtualAssets","#type","feed","theme","Feed","Article","Category","assets","item","image","URL","item: Item","dir: string | undefined","path","dir","sharp","VirtualAssets","URL","asset","#filepath","#ext","#optimizedPath","fs","db: DB.Database","statements: Record<'get' | 'update' | 'delete', DB.Statement>","path","DB","asset","color: string | null","Vibrant","metadata: ImageMetadata","path","logger","Logger","asset","ext","fs","assets","logger","Logger","urls: string[]","Article","Page","IndexNow","SEARCH_ENGINES","layoutConfig: LayoutConfig","path","path","cleaner","CleanCSS","VirtualAssets","Cache","#baseCache","asset: CodeblockStyle","asset","ModelOperations","shiki: HighlighterGeneric<BundledLanguage, BundledTheme>","shikiClassName: string[]","transformers: ShikiTransformer[]","shiki","theme","utils","result: string[]","name","$","origin","plugins","render","indented: CommonPlugin<'block', CodeblockParsed>","fenced: CommonPlugin<'block', CodeblockParsed>","PATTERN_START","utils","fold: CommonPlugin<'block', FoldParsed>","source","$","utils","render: RendererPlugin<'inline', LinkParsed>","$","ast: ASTPlugin<'inline', LinkNode>","LinkNode","ParsedNode","source: CommonPlugin<'block', SourceParsed>","contents: string[]","id: [string, string][]","indentState: boolean | null","source","utils","$","URL","html: string[]","mime","blockRender: RendererPlugin<'block', ImageParsed>","block: ASTPlugin<'inline', ParsedNode>","Paragraph","ImageNode","image","ParsedNode","inline: ASTPlugin<'inline', ImageNode>","node","utils","kbd: CommonPlugin<'inline', KbdParsed>","source","$","utils","link: ASTPlugin<'inline', LinkNode>","LinkNode","node","$","URL","utils","links: CommonPlugin<'block', LinksParsed>","source","matched","$","links","html: string[]","URL","PATTERN_START","utils","mermaid: CommonPlugin<'block', MermaidParsed>","source","$","PATTERN_START","utils","NOTE_TITLE: Record<string, string>","note: CommonPlugin<'block', NoteParsed>","source","$","utils","plugins","table: typeof origin","$","source","utils","tabs: CommonPlugin<'block', TabsParsed, number>","source","children: TabsParsed['children']","id: TabsParsed['id']","content","inline: CommonPlugin<'inline', TexParsed>","source","tex","logger","block: CommonPlugin<'block', TexParsed>","logger","Logger","EzalMarkdown","setext: CommonPlugin<'block'>","plugins","fs","config","VirtualPage","indexPage: ArchivePage","getArticles","Article","VirtualPage","scanned","createPage","data: CategoryPageData","VirtualPage","scanned","Category","pages: HomePage[]","index","Article","createPage","data: HomePageData","VirtualPage","scanned","data: TagPageData","VirtualPage","Tag","Logger","index: pagefind.PagefindIndex","VirtualAssets","path","asset","Article","errors: string[]","Page","img","URL","VirtualAssets","SitemapStream","Article","Page","asset: Sitemap","scriptTransformRule: TransformRule","path","src","STYLE_CONFIGS: Record<string, () => any>","CleanCSS","styleTransformRule: TransformRule","fs","renderer","path","config","path"],"sources":["../src/config.ts","../src/utils.ts","../src/feed.ts","../src/image/utils.ts","../src/image/asset.ts","../src/image/db.ts","../src/image/metadata.ts","../src/image/index.ts","../src/index-now.ts","../src/layout.ts","../src/markdown/codeblock/data.ts","../src/markdown/codeblock/style.ts","../src/markdown/codeblock/index.ts","../src/markdown/fold.ts","../src/markdown/footnote.ts","../src/markdown/image.ts","../src/markdown/kbd.ts","../src/markdown/link.ts","../src/markdown/links.ts","../src/markdown/mermaid.ts","../src/markdown/note.ts","../src/markdown/table.ts","../src/markdown/tabs.ts","../src/markdown/tex.ts","../src/markdown/index.ts","../src/page/404.ts","../src/page/archive.ts","../src/page/category.ts","../src/page/home.ts","../src/page/tag.ts","../src/pagefind.ts","../src/sitemap.ts","../src/transform/script.ts","../src/transform/stylus.ts","../src/index.ts"],"sourcesContent":["import type { Temporal } from '@js-temporal/polyfill';\nimport type { ArrayOr } from 'ezal';\nimport type { TokenizeOptions } from 'ezal-markdown';\nimport type { RawTheme } from 'shiki';\n\nexport interface NavItem {\n\tname: string;\n\tlink: string;\n}\n\nexport interface Contact {\n\turl: string;\n\tname: string;\n\ticon: string;\n\tcolor: string;\n}\n\nexport interface Link {\n\tname: string;\n\tdescription: string;\n\tlink: string;\n\tavatar: string;\n\tcolor: string;\n}\n\nexport interface LinkGroup {\n\ttitle: string;\n\tdescription: string;\n\titems: Link[];\n}\n\nexport type LinkPageStyles =\n\t| 'image'\n\t| 'table'\n\t| 'heading'\n\t| 'list'\n\t| 'footnote'\n\t| 'tabs'\n\t| 'note'\n\t| 'fold'\n\t| 'kbd';\n\nexport interface ThemeConfig {\n\t/** 导航栏 */\n\tnav?: NavItem[];\n\t/** 站点图标 */\n\tfavicon?: ArrayOr<string>;\n\t/** 主题色 */\n\tcolor?: {\n\t\t/** @default '#006000' */\n\t\tlight?: string;\n\t\t/** @default '#00BB00' */\n\t\tdark?: string;\n\t};\n\t/** 建站时间 */\n\tsince?: Temporal.ZonedDateTime;\n\t/** 联系方式 */\n\tcontact?: Contact[];\n\t/** 友情链接 */\n\tlinks?: LinkGroup[];\n\t/**\n\t * 友情链接页面启用的样式\n\t * @default 全部启用\n\t */\n\tlinkPageStyles?: LinkPageStyles[];\n\t/** Markdown 配置 */\n\tmarkdown?: {\n\t\t/**\n\t\t * 换行规则\n\t\t * @description\n\t\t * - `common-mark`:CommonMark 规范,行尾 2+ 空格渲染为换行\n\t\t * - `soft`:软换行,换行符 `\\n` 渲染为换行\n\t\t * @default `common-mark`\n\t\t */\n\t\tlineBreak?: TokenizeOptions['lineBreak'];\n\t\t/**\n\t\t * 代码块主题\n\t\t * @default {light:'light-plus',dark:'dark-plus'}\n\t\t */\n\t\tcodeBlockTheme?: { light: RawTheme; dark: RawTheme };\n\t};\n\t/** 主页设置 */\n\thome?: {\n\t\t/**\n\t\t * 每页文章数量\n\t\t * @default 10\n\t\t */\n\t\tarticlesPrePage?: number;\n\t\tlogo?: {\n\t\t\tviewBox: string;\n\t\t\tg: string;\n\t\t};\n\t\tslogan?: string;\n\t};\n\timageCache?: {\n\t\t/**\n\t\t * 图像元数据缓存路径\n\t\t * @description\n\t\t * 支持绝对路径和相对路径,相对路径将以工作目录为起点。\n\t\t * 默认为工作目录下 `image-metadata.sqlite`。\n\t\t */\n\t\tmetadata?: string;\n\t\t/**\n\t\t * 优化版图像缓存路径\n\t\t * @description\n\t\t * 支持绝对路径和相对路径,相对路径将以工作目录为起点。\n\t\t * 默认为工作目录下 `cache`。\n\t\t */\n\t\toptimized?: string;\n\t};\n\tcdn?: {\n\t\t/** @default 'https://unpkg.com/katex@0.16.21/dist/katex.min.css' */\n\t\tkatex?: string;\n\t\t/** @default 'https://unpkg.com/@waline/client@v3/dist/waline.css' */\n\t\twalineCSS?: string;\n\t\t/** @default 'https://unpkg.com/@waline/client@v3/dist/waline.js' */\n\t\twalineJS?: string;\n\t\t/** @default 'https://unpkg.com/mermaid@11/dist/mermaid.esm.min.mjs' */\n\t\tmermaid?: string;\n\t};\n\t/** HTML 头部插入内容 */\n\tinject?: string;\n\t/** IndexNow 配置 */\n\tindexNow?: {\n\t\t/** Bing IndexNow 密钥 */\n\t\tbing?: string;\n\t\t/** Yandex IndexNow 密钥 */\n\t\tyandex?: string;\n\t};\n\t/** Waline 评论配置 */\n\twaline?: {\n\t\t/** 后端地址 */\n\t\tserverURL: string;\n\t\tvisitor?: boolean;\n\t\tcommentCount?: boolean;\n\t\tpageview?: boolean;\n\t\temoji?: string[];\n\t\treaction?: string[];\n\t};\n}\n\nlet config: ThemeConfig;\n\nexport function setThemeConfig(cfg?: ThemeConfig) {\n\tconfig = cfg ?? {};\n}\n\nexport function getThemeConfig() {\n\treturn config;\n}\n","import type { Article } from 'ezal';\n\nexport function compareByDate(a: Article, b: Article): number {\n\treturn b.date.epochMilliseconds - a.date.epochMilliseconds;\n}\n","import { Article, Category, getConfig, URL, VirtualAssets } from 'ezal';\nimport { type Author, Feed, type Item } from 'feed';\nimport { getThemeConfig } from './config';\nimport { compareByDate } from './utils';\n\nconst FEED_TYPE_URL = {\n\trss: '/rss.xml',\n\tatom: '/atom.xml',\n\tfeed: '/feed.json',\n} as const;\n\nlet author: Author;\nlet feed: Feed;\nlet assets: { rss: FeedAsset; atom: FeedAsset; feed: FeedAsset };\n\nclass FeedAsset extends VirtualAssets {\n\t#type: 'rss' | 'atom' | 'feed';\n\tconstructor(type: 'rss' | 'atom' | 'feed') {\n\t\tsuper(FEED_TYPE_URL[type]);\n\t\tthis.#type = type;\n\t}\n\tbuild() {\n\t\tswitch (this.#type) {\n\t\t\tcase 'rss':\n\t\t\t\treturn feed.rss2();\n\t\t\tcase 'atom':\n\t\t\t\treturn feed.atom1();\n\t\t\tcase 'feed':\n\t\t\t\treturn feed.json1();\n\t\t\tdefault:\n\t\t\t\treturn '';\n\t\t}\n\t}\n\tprotected onDependenciesChanged() {}\n}\n\nexport function initFeed() {\n\tconst { site } = getConfig();\n\tconst theme = getThemeConfig();\n\tconst since = theme.since?.year;\n\tauthor = { name: site.author, link: site.domain };\n\tfeed = new Feed({\n\t\ttitle: site.title,\n\t\tdescription: site.description,\n\t\tid: site.domain,\n\t\tlanguage: site.language,\n\t\tfavicon: theme.favicon?.[0],\n\t\tcopyright: `© ${since ? `${since}-` : ''}${new Date().getFullYear()} ${site.author}`,\n\t\tauthor,\n\t\tupdated: new Date(),\n\t\tfeedLinks: {\n\t\t\trss: `${site.domain}/rss.xml`,\n\t\t\tatom: `${site.domain}/atom.xml`,\n\t\t\tjson: `${site.domain}/feed.json`,\n\t\t},\n\t});\n\tassets = {\n\t\trss: new FeedAsset('rss'),\n\t\tatom: new FeedAsset('atom'),\n\t\tfeed: new FeedAsset('feed'),\n\t};\n\tfor (const article of Article.getAll().sort(compareByDate)) {\n\t\tupdateFeedItem(article);\n\t}\n\tfor (const category of Category.getAll()) {\n\t\tupdateFeedCategory(category);\n\t}\n}\n\nfunction refreshAsset() {\n\tif (!assets) return;\n\tassets.rss.invalidated();\n\tassets.atom.invalidated();\n\tassets.feed.invalidated();\n}\n\nexport function updateFeedItem(article: Article) {\n\tif (!feed) return;\n\tconst i = feed.items.findIndex((item) => item.id === article.id);\n\t// Delete\n\tif (article.destroyed) {\n\t\tif (i === -1) return;\n\t\tfeed.items.splice(i, 1);\n\t\treturn refreshAsset();\n\t}\n\t// Update\n\tconst { site } = getConfig();\n\tlet image = article.data?.cover\n\t\t? URL.resolve(article.url, article.data.cover)\n\t\t: undefined;\n\tif (image) image = site.domain + image;\n\tconst item: Item = {\n\t\ttitle: article.title,\n\t\tid: article.id,\n\t\tlink: site.domain + article.url,\n\t\tdescription: article.description,\n\t\tcontent: article.content,\n\t\tauthor: [author],\n\t\tdate: new Date(article.date.toInstant().epochMilliseconds),\n\t\timage,\n\t\tcategory: article.categories\n\t\t\t.values()\n\t\t\t.toArray()\n\t\t\t.map((category) => ({ name: category.path.join('/') })),\n\t};\n\tif (i === -1) feed.addItem(item);\n\telse feed.items[i] = item;\n\trefreshAsset();\n}\n\nexport function updateFeedCategory(category: Category) {\n\tif (!feed) return;\n\tconst name = category.path.join('/');\n\tconst i = feed.categories.indexOf(name);\n\t// Delete\n\tif (category.destroyed) {\n\t\tif (i === -1) return;\n\t\tfeed.categories.splice(i, 1);\n\t\treturn refreshAsset();\n\t}\n\t// Update\n\tif (i !== -1) return;\n\tfeed.addCategory(name);\n\trefreshAsset();\n}\n","import path from 'node:path';\nimport { getThemeConfig } from '../config';\n\nlet dir: string | undefined;\nfunction getCacheDir(): string {\n\tif (dir) return dir;\n\tdir = getThemeConfig().imageCache?.optimized ?? 'cache';\n\tif (!path.isAbsolute(dir)) dir = path.resolve(dir);\n\treturn dir;\n}\n\nexport function getOptimizedPath(filepath: string, ext: string): string {\n\tconst dir = getCacheDir();\n\tconst cachePath = path.relative(process.cwd(), filepath);\n\treturn `${path.join(dir, cachePath)}.opt${ext}`;\n}\n","import { createReadStream } from 'node:fs';\nimport { type Asset, fs, URL, VirtualAssets } from 'ezal';\nimport Sharp from 'sharp';\nimport { getOptimizedPath } from './utils';\n\nconst OPTIMIZE = {\n\t'.avif': (sharp) => sharp.avif().toBuffer(),\n\t'.webp': (sharp) => sharp.webp().toBuffer(),\n\t'.jxl': (sharp) => sharp.jxl().toBuffer(),\n\t'.jpg': (sharp) =>\n\t\tsharp\n\t\t\t.jpeg({\n\t\t\t\ttrellisQuantisation: true,\n\t\t\t\tovershootDeringing: true,\n\t\t\t\tprogressive: true,\n\t\t\t\toptimiseScans: true,\n\t\t\t})\n\t\t\t.toBuffer(),\n\t'.png': (sharp) =>\n\t\tsharp.png({ progressive: true, adaptiveFiltering: true }).toBuffer(),\n\t'.gif': (sharp) => sharp.gif().toBuffer(),\n} as const satisfies Record<string, (sharp: Sharp.Sharp) => Promise<Buffer>>;\n\nexport type OptimizedImageExt = keyof typeof OPTIMIZE;\n\nexport class OptimizedImage extends VirtualAssets {\n\t#optimizedPath: string;\n\t#filepath: string;\n\t#ext: OptimizedImageExt;\n\t/**\n\t * @param asset 源资源\n\t * @param target 目标优化格式\n\t */\n\tconstructor(asset: Asset, ext: OptimizedImageExt) {\n\t\tsuper(URL.extname(asset.url, `.opt${ext}`));\n\t\tthis.#filepath = asset.filepath;\n\t\tthis.#ext = ext;\n\t\tthis.#optimizedPath = getOptimizedPath(this.#filepath, ext);\n\t}\n\tasync build() {\n\t\tif (await fs.isFile(this.#optimizedPath)) {\n\t\t\treturn createReadStream(this.#optimizedPath);\n\t\t}\n\t\tconst sharp = Sharp(this.#filepath);\n\t\tconst buffer = await OPTIMIZE[this.#ext](sharp);\n\t\tfs.writeFile(this.#optimizedPath, buffer);\n\t\treturn buffer;\n\t}\n\tprotected onDependenciesChanged() {}\n}\n","import path from 'node:path';\nimport DB from 'better-sqlite3';\nimport { getThemeConfig } from '../config';\n\nexport interface ImageMetadata {\n\tpath: string;\n\thash: string;\n\twidth: number;\n\theight: number;\n\tcolor: string | null;\n}\n\nlet db: DB.Database;\nlet statements: Record<'get' | 'update' | 'delete', DB.Statement>;\n\nfunction getMetadata(url: string): ImageMetadata | null {\n\treturn statements.get.get(url) as ImageMetadata | null;\n}\n\nfunction updateMetadata(data: ImageMetadata): boolean {\n\treturn (\n\t\tstatements.update.run(\n\t\t\tdata.path,\n\t\t\tdata.hash,\n\t\t\tdata.width,\n\t\t\tdata.height,\n\t\t\tdata.color,\n\t\t).changes !== 0\n\t);\n}\n\nfunction deleteMetadata(url: string): boolean {\n\treturn statements.delete.run(url).changes !== 0;\n}\n\nfunction initImageMetadataDB() {\n\tlet filename =\n\t\tgetThemeConfig().imageCache?.metadata ?? 'image-metadata.sqlite';\n\tif (!path.isAbsolute(filename)) filename = path.resolve(filename);\n\tdb = new DB(filename);\n\tdb.exec(`CREATE TABLE IF NOT EXISTS image_metadata (\n\t\tpath TEXT PRIMARY KEY,\n\t\thash TEXT NOT NULL,\n\t\twidth INTEGER NOT NULL,\n\t\theight INTEGER NOT NULL,\n\t\tcolor TEXT(8)\n\t)`);\n\tstatements = {\n\t\tget: db.prepare('SELECT * FROM image_metadata WHERE path = ?'),\n\t\tdelete: db.prepare('DELETE FROM image_metadata WHERE path = ?'),\n\t\tupdate: db.prepare(`INSERT OR REPLACE INTO image_metadata\n\t\t\t(path, hash, width, height, color)\n\t\t\tVALUES (?, ?, ?, ?, ?)\n\t\t`),\n\t};\n}\n\nexport const imageDB = {\n\tinit: initImageMetadataDB,\n\tget: getMetadata,\n\tupdate: updateMetadata,\n\tdelete: deleteMetadata,\n};\n","import { createHash } from 'node:crypto';\nimport { readFile } from 'node:fs/promises';\nimport type { Asset } from 'ezal';\nimport { Vibrant } from 'node-vibrant/node';\nimport Sharp from 'sharp';\nimport { type ImageMetadata, imageDB } from './db';\n\nexport async function updateImageMetadata(asset: Asset): Promise<boolean> {\n\tconst buffer = await readFile(asset.filepath);\n\t// Hash\n\tconst hash = createHash('sha256').update(buffer).digest('hex');\n\t// Check\n\tif (imageDB.get(asset.url)?.hash === hash) return false;\n\t// Size\n\tconst sharp = Sharp(buffer);\n\tconst { width, height, format } = await sharp.metadata();\n\t// Color\n\tlet color: string | null = null;\n\tif (format !== 'svg') {\n\t\ttry {\n\t\t\tconst palette = await Vibrant.from(buffer).getPalette();\n\t\t\tcolor = palette.Muted?.hex ?? null;\n\t\t} catch {}\n\t}\n\t// Update\n\tconst metadata: ImageMetadata = {\n\t\tpath: asset.url,\n\t\thash,\n\t\twidth,\n\t\theight,\n\t\tcolor,\n\t};\n\timageDB.update(metadata);\n\treturn true;\n}\n","import path from 'node:path/posix';\nimport { type Asset, fs, Logger } from 'ezal';\nimport { OptimizedImage, type OptimizedImageExt } from './asset';\nimport { type ImageMetadata, imageDB } from './db';\nimport { updateImageMetadata } from './metadata';\nimport { getOptimizedPath } from './utils';\n\nexport interface ImageInfo {\n\tmetadata: ImageMetadata | null;\n\trule?: string[];\n}\n\nconst INFO = {\n\tADD: 'Add image file:',\n\tUPDATE: 'Update image file:',\n\tREMOVE: 'Remove image file:',\n\tOPTIMIZE: (path: string) =>\n\t\t`The image \"${path}\" will be generated in this format:`,\n} as const;\nconst ERR = {\n\tMETADATA: (path: string) => `Unable to update metadata for \"${path}\"`,\n} as const;\n\nconst SUPPORT_EXTS = new Set<string>([\n\t'.jpeg',\n\t'.jpg',\n\t'.png',\n\t'.gif',\n\t'.webp',\n\t'.svg',\n\t'.tiff',\n\t'.tif',\n\t'.avif',\n\t'.heif',\n\t'.jxl',\n]);\n\nconst OPTIMIZE_RULES = new Map<string, OptimizedImageExt[]>([\n\t['.jpeg', ['.avif', '.webp', '.jxl', '.jpg']],\n\t['.jpg', ['.avif', '.webp', '.jpg']],\n\t['.png', ['.avif', '.webp', '.png']],\n\t['.webp', ['.avif', '.webp', '.png']],\n\t['.avif', ['.avif', '.webp', '.png']],\n]);\n\nconst logger = new Logger('theme:image');\n\nconst assetsMap = new Map<string, OptimizedImage[]>();\n\nexport function getImageInfo(url: string): ImageInfo | null {\n\tconst ext = path.extname(url).toLowerCase();\n\tif (!SUPPORT_EXTS.has(ext)) return null;\n\tconst metadata = imageDB.get(url);\n\tconst rule = OPTIMIZE_RULES.get(ext);\n\treturn { metadata, rule };\n}\n\nasync function cleanOptimized(asset: Asset) {\n\tconst ext = path.extname(asset.filepath).toLowerCase();\n\tconst rule = OPTIMIZE_RULES.get(ext);\n\tif (!rule) return;\n\tawait Promise.all(\n\t\trule\n\t\t\t.map((ext) => getOptimizedPath(asset.filepath, ext))\n\t\t\t.map((filepath) => fs.remove(filepath)),\n\t);\n}\n\nexport async function imageAddHook(asset: Asset) {\n\tif (asset.level !== 'user') return;\n\tconst ext = path.extname(asset.filepath).toLowerCase();\n\tif (!SUPPORT_EXTS.has(ext)) return;\n\tlogger.debug(INFO.ADD, asset.filepath);\n\tlet updated = false;\n\t// Metadata\n\ttry {\n\t\tupdated = await updateImageMetadata(asset);\n\t} catch (error) {\n\t\tlogger.error(ERR.METADATA(asset.filepath), error);\n\t}\n\t// Asset\n\tif (updated) await cleanOptimized(asset);\n\tconst rule = OPTIMIZE_RULES.get(ext);\n\tif (!rule) return;\n\tlogger.debug(INFO.OPTIMIZE(asset.filepath), rule);\n\tconst assets = rule\n\t\t.map<OptimizedImage | null>((ext) => {\n\t\t\ttry {\n\t\t\t\treturn new OptimizedImage(asset, ext);\n\t\t\t} catch (error) {\n\t\t\t\tlogger.warn(error);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t})\n\t\t.filter((v) => v) as OptimizedImage[];\n\tassetsMap.set(asset.url, assets);\n}\n\nexport async function imageUpdateHook(asset: Asset) {\n\tif (asset.level !== 'user') return;\n\tconst ext = path.extname(asset.filepath).toLowerCase();\n\tif (!SUPPORT_EXTS.has(ext)) return;\n\tlogger.debug(INFO.UPDATE, asset.filepath);\n\tlet updated = false;\n\t// Metadata\n\ttry {\n\t\tupdated = await updateImageMetadata(asset);\n\t} catch (error) {\n\t\tlogger.error(ERR.METADATA(asset.filepath), error);\n\t}\n\t// Asset\n\tif (updated) await cleanOptimized(asset);\n\tconst assets = assetsMap.get(asset.url);\n\tif (!assets) return;\n\tfor (const asset of assets) {\n\t\tasset.invalidated();\n\t}\n}\n\nexport function imageRemoveHook(asset: Asset) {\n\tif (asset.level !== 'user') return;\n\tconst ext = path.extname(asset.filepath).toLowerCase();\n\tif (!SUPPORT_EXTS.has(ext)) return;\n\tlogger.debug(INFO.REMOVE, asset.filepath);\n\timageDB.delete(asset.filepath);\n\tconst assets = assetsMap.get(asset.url);\n\tif (!assets) return;\n\tassetsMap.delete(asset.url);\n\tfor (const asset of assets) {\n\t\tasset.destroy();\n\t}\n}\n","import { Article, getConfig, Logger, Page } from 'ezal';\nimport IndexNow, { SEARCH_ENGINES } from 'indexnow';\nimport { getThemeConfig } from './config';\n\nconst logger = new Logger('theme:index-now');\n\nexport async function exeIndexNow() {\n\tconst { site } = getConfig();\n\tconst { indexNow } = getThemeConfig();\n\tif (!indexNow) return;\n\n\tlogger.log('Collecting data...');\n\tconst urls: string[] = [];\n\tfor (const article of Article.getAll()) {\n\t\tif (article.data?.robots === false) continue;\n\t\turls.push(site.domain + article.url);\n\t}\n\tfor (const page of Page.getAll()) {\n\t\tif (!page.data?.robots) continue;\n\t\turls.push(site.domain + page.url);\n\t}\n\n\tif (indexNow.bing) {\n\t\tlogger.log('Submitting urls to Bing...');\n\t\tconst bing = new IndexNow(SEARCH_ENGINES.BING, indexNow.bing);\n\t\tawait bing.submitUrls(site.domain, urls);\n\t}\n\n\tif (indexNow.yandex) {\n\t\tlogger.log('Submitting urls to Yandex...');\n\t\tconst bing = new IndexNow(SEARCH_ENGINES.YANDEX, indexNow.yandex);\n\t\tawait bing.submitUrls(site.domain, urls);\n\t}\n\n\tlogger.log('Finished');\n}\n","import path from 'node:path';\nimport { getConfig, type LayoutConfig } from 'ezal';\nimport { createCompiler } from 'ezal-layout';\nimport mime from 'mime-types';\nimport type { Context } from '../layouts/context';\nimport { getThemeConfig } from './config';\nimport { getImageInfo } from './image';\nimport { compareByDate } from './utils';\n\nconst EXTERNAL_MODULES = Object.fromEntries(\n\t['mime-types', 'ezal', '@js-temporal/polyfill'].map<[string, any]>((name) => [\n\t\tname,\n\t\trequire(name),\n\t]),\n);\n\nexport const layoutConfig: LayoutConfig = {\n\troot: path.join(__dirname, '../layouts'),\n\tcompiler: createCompiler({\n\t\tcontext(page): Context {\n\t\t\tconst { site } = getConfig();\n\t\t\tconst theme = getThemeConfig();\n\t\t\treturn {\n\t\t\t\tpage: page as Context['page'],\n\t\t\t\tsite,\n\t\t\t\ttheme,\n\t\t\t\tgetImageInfo,\n\t\t\t\tmime,\n\t\t\t\tcompareByDate,\n\t\t\t};\n\t\t},\n\t\texternal: EXTERNAL_MODULES,\n\t}),\n};\n","export const LANGUAGE_MAP = new Map([\n\t['markup', 'Markup'],\n\t['html', 'HTML'],\n\t['xml', 'XML'],\n\t['svg', 'SVG'],\n\t['mathml', 'MathML'],\n\t['ssml', 'SSML'],\n\t['atom', 'Atom'],\n\t['rss', 'RSS'],\n\t['css', 'CSS'],\n\t['clike', 'C-like'],\n\t['javascript', 'JavaScript'],\n\t['js', 'JavaScript'],\n\t['abap', 'ABAP'],\n\t['abnf', 'ABNF'],\n\t['actionscript', 'ActionScript'],\n\t['ada', 'Ada'],\n\t['agda', 'Agda'],\n\t['al', 'AL'],\n\t['antlr4', 'ANTLR4'],\n\t['g4', 'ANTLR4'],\n\t['apacheconf', 'Apache Configuration'],\n\t['apex', 'Apex'],\n\t['apl', 'APL'],\n\t['applescript', 'AppleScript'],\n\t['aql', 'AQL'],\n\t['arduino', 'Arduino'],\n\t['ino', 'Arduino'],\n\t['arff', 'ARFF'],\n\t['armasm', 'ARM Assembly'],\n\t['arm-asm', 'ARM Assembly'],\n\t['arturo', 'Arturo'],\n\t['art', 'Arturo'],\n\t['asciidoc', 'AsciiDoc'],\n\t['adoc', 'AsciiDoc'],\n\t['aspnet', 'ASP.NET (C#)'],\n\t['asm6502', '6502 Assembly'],\n\t['asmatmel', 'Atmel AVR Assembly'],\n\t['autohotkey', 'AutoHotkey'],\n\t['autoit', 'AutoIt'],\n\t['avisynth', 'AviSynth'],\n\t['avs', 'AviSynth'],\n\t['avro-idl', 'Avro IDL'],\n\t['avdl', 'Avro IDL'],\n\t['awk', 'AWK'],\n\t['gawk', 'AWK'],\n\t['bash', 'Bash'],\n\t['sh', 'Bash'],\n\t['shell', 'Bash'],\n\t['basic', 'BASIC'],\n\t['batch', 'Batch'],\n\t['bbcode', 'BBcode'],\n\t['shortcode', 'BBcode'],\n\t['bbj', 'BBj'],\n\t['bicep', 'Bicep'],\n\t['birb', 'Birb'],\n\t['bison', 'Bison'],\n\t['bnf', 'BNF'],\n\t['rbnf', 'BNF'],\n\t['bqn', 'BQN'],\n\t['brainfuck', 'Brainfuck'],\n\t['brightscript', 'BrightScript'],\n\t['bro', 'Bro'],\n\t['bsl', 'BSL (1C:Enterprise)'],\n\t['oscript', 'BSL (1C:Enterprise)'],\n\t['c', 'C'],\n\t['csharp', 'C#'],\n\t['cs', 'C#'],\n\t['dotnet', 'C#'],\n\t['cpp', 'C++'],\n\t['cfscript', 'CFScript'],\n\t['cfc', 'CFScript'],\n\t['chaiscript', 'ChaiScript'],\n\t['cil', 'CIL'],\n\t['cilkc', 'Cilk/C'],\n\t['cilk-c', 'Cilk/C'],\n\t['cilkcpp', 'Cilk/C++'],\n\t['cilk-cpp', 'Cilk/C++'],\n\t['cilk', 'Cilk/C++'],\n\t['clojure', 'Clojure'],\n\t['cmake', 'CMake'],\n\t['cobol', 'COBOL'],\n\t['coffeescript', 'CoffeeScript'],\n\t['coffee', 'CoffeeScript'],\n\t['concurnas', 'Concurnas'],\n\t['conc', 'Concurnas'],\n\t['csp', 'Content-Security-Policy'],\n\t['cooklang', 'Cooklang'],\n\t['coq', 'Coq'],\n\t['crystal', 'Crystal'],\n\t['css-extras', 'CSS Extras'],\n\t['csv', 'CSV'],\n\t['cue', 'CUE'],\n\t['cypher', 'Cypher'],\n\t['d', 'D'],\n\t['dart', 'Dart'],\n\t['dataweave', 'DataWeave'],\n\t['dax', 'DAX'],\n\t['dhall', 'Dhall'],\n\t['diff', 'Diff'],\n\t['django', 'Django/Jinja2'],\n\t['jinja2', 'Django/Jinja2'],\n\t['dns-zone-file', 'DNS zone file'],\n\t['dns-zone', 'DNS zone file'],\n\t['docker', 'Docker'],\n\t['dockerfile', 'Docker'],\n\t['dot', 'DOT (Graphviz)'],\n\t['gv', 'DOT (Graphviz)'],\n\t['ebnf', 'EBNF'],\n\t['editorconfig', 'EditorConfig'],\n\t['eiffel', 'Eiffel'],\n\t['ejs', 'EJS'],\n\t['eta', 'EJS'],\n\t['elixir', 'Elixir'],\n\t['elm', 'Elm'],\n\t['etlua', 'Embedded Lua templating'],\n\t['erb', 'ERB'],\n\t['erlang', 'Erlang'],\n\t['excel-formula', 'Excel Formula'],\n\t['xlsx', 'Excel Formula'],\n\t['xls', 'Excel Formula'],\n\t['fsharp', 'F#'],\n\t['factor', 'Factor'],\n\t['false', 'False'],\n\t['firestore-security-rules', 'Firestore security rules'],\n\t['flow', 'Flow'],\n\t['fortran', 'Fortran'],\n\t['ftl', 'FreeMarker Template Language'],\n\t['gml', 'GameMaker Language'],\n\t['gamemakerlanguage', 'GameMaker Language'],\n\t['gap', 'GAP (CAS)'],\n\t['gcode', 'G-code'],\n\t['gdscript', 'GDScript'],\n\t['gedcom', 'GEDCOM'],\n\t['gettext', 'gettext'],\n\t['po', 'gettext'],\n\t['gherkin', 'Gherkin'],\n\t['git', 'Git'],\n\t['glsl', 'GLSL'],\n\t['gn', 'GN'],\n\t['gni', 'GN'],\n\t['linker-script', 'GNU Linker Script'],\n\t['ld', 'GNU Linker Script'],\n\t['go', 'Go'],\n\t['go-module', 'Go module'],\n\t['go-mod', 'Go module'],\n\t['gradle', 'Gradle'],\n\t['graphql', 'GraphQL'],\n\t['groovy', 'Groovy'],\n\t['haml', 'Haml'],\n\t['handlebars', 'Handlebars'],\n\t['hbs', 'Handlebars'],\n\t['mustache', 'Handlebars'],\n\t['haskell', 'Haskell'],\n\t['hs', 'Haskell'],\n\t['haxe', 'Haxe'],\n\t['hcl', 'HCL'],\n\t['hlsl', 'HLSL'],\n\t['hoon', 'Hoon'],\n\t['http', 'HTTP'],\n\t['hpkp', 'HTTP Public-Key-Pins'],\n\t['hsts', 'HTTP Strict-Transport-Security'],\n\t['ichigojam', 'IchigoJam'],\n\t['icon', 'Icon'],\n\t['icu-message-format', 'ICU Message Format'],\n\t['idris', 'Idris'],\n\t['idr', 'Idris'],\n\t['ignore', '.ignore'],\n\t['gitignore', '.ignore'],\n\t['hgignore', '.ignore'],\n\t['npmignore', '.ignore'],\n\t['inform7', 'Inform 7'],\n\t['ini', 'Ini'],\n\t['io', 'Io'],\n\t['j', 'J'],\n\t['java', 'Java'],\n\t['javadoc', 'JavaDoc'],\n\t['javadoclike', 'JavaDoc-like'],\n\t['javastacktrace', 'Java stack trace'],\n\t['jexl', 'Jexl'],\n\t['jolie', 'Jolie'],\n\t['jq', 'JQ'],\n\t['jsdoc', 'JSDoc'],\n\t['js-extras', 'JS Extras'],\n\t['json', 'JSON'],\n\t['webmanifest', 'JSON'],\n\t['json5', 'JSON5'],\n\t['jsonp', 'JSONP'],\n\t['jsstacktrace', 'JS stack trace'],\n\t['js-templates', 'JS Templates'],\n\t['julia', 'Julia'],\n\t['keepalived', 'Keepalived Configure'],\n\t['keyman', 'Keyman'],\n\t['kotlin', 'Kotlin'],\n\t['kt', 'Kotlin'],\n\t['kts', 'Kotlin'],\n\t['kumir', 'KuMir (КуМир)'],\n\t['kum', 'KuMir (КуМир)'],\n\t['kusto', 'Kusto'],\n\t['latex', 'LaTeX'],\n\t['tex', 'LaTeX'],\n\t['context', 'LaTeX'],\n\t['latte', 'Latte'],\n\t['less', 'Less'],\n\t['lilypond', 'LilyPond'],\n\t['ly', 'LilyPond'],\n\t['liquid', 'Liquid'],\n\t['lisp', 'Lisp'],\n\t['emacs', 'Lisp'],\n\t['elisp', 'Lisp'],\n\t['emacs-lisp', 'Lisp'],\n\t['livescript', 'LiveScript'],\n\t['llvm', 'LLVM IR'],\n\t['log', 'Log file'],\n\t['lolcode', 'LOLCODE'],\n\t['lua', 'Lua'],\n\t['magma', 'Magma (CAS)'],\n\t['makefile', 'Makefile'],\n\t['markdown', 'Markdown'],\n\t['md', 'Markdown'],\n\t['markup-templating', 'Markup templating'],\n\t['mata', 'Mata'],\n\t['matlab', 'MATLAB'],\n\t['maxscript', 'MAXScript'],\n\t['mel', 'MEL'],\n\t['mermaid', 'Mermaid'],\n\t['metafont', 'METAFONT'],\n\t['mizar', 'Mizar'],\n\t['mongodb', 'MongoDB'],\n\t['monkey', 'Monkey'],\n\t['moonscript', 'MoonScript'],\n\t['moon', 'MoonScript'],\n\t['n1ql', 'N1QL'],\n\t['n4js', 'N4JS'],\n\t['n4jsd', 'N4JS'],\n\t['nand2tetris-hdl', 'Nand To Tetris HDL'],\n\t['naniscript', 'Naninovel Script'],\n\t['nani', 'Naninovel Script'],\n\t['nasm', 'NASM'],\n\t['neon', 'NEON'],\n\t['nevod', 'Nevod'],\n\t['nginx', 'nginx'],\n\t['nim', 'Nim'],\n\t['nix', 'Nix'],\n\t['nsis', 'NSIS'],\n\t['objectivec', 'Objective-C'],\n\t['objc', 'Objective-C'],\n\t['ocaml', 'OCaml'],\n\t['odin', 'Odin'],\n\t['opencl', 'OpenCL'],\n\t['openqasm', 'OpenQasm'],\n\t['qasm', 'OpenQasm'],\n\t['oz', 'Oz'],\n\t['parigp', 'PARI/GP'],\n\t['parser', 'Parser'],\n\t['pascal', 'Pascal'],\n\t['objectpascal', 'Pascal'],\n\t['pascaligo', 'Pascaligo'],\n\t['psl', 'PATROL Scripting Language'],\n\t['pcaxis', 'PC-Axis'],\n\t['px', 'PC-Axis'],\n\t['peoplecode', 'PeopleCode'],\n\t['pcode', 'PeopleCode'],\n\t['perl', 'Perl'],\n\t['php', 'PHP'],\n\t['phpdoc', 'PHPDoc'],\n\t['php-extras', 'PHP Extras'],\n\t['plant-uml', 'PlantUML'],\n\t['plantuml', 'PlantUML'],\n\t['plsql', 'PL/SQL'],\n\t['powerquery', 'PowerQuery'],\n\t['pq', 'PowerQuery'],\n\t['mscript', 'PowerQuery'],\n\t['powershell', 'PowerShell'],\n\t['processing', 'Processing'],\n\t['prolog', 'Prolog'],\n\t['promql', 'PromQL'],\n\t['properties', '.properties'],\n\t['protobuf', 'Protocol Buffers'],\n\t['pug', 'Pug'],\n\t['puppet', 'Puppet'],\n\t['pure', 'Pure'],\n\t['purebasic', 'PureBasic'],\n\t['pbfasm', 'PureBasic'],\n\t['purescript', 'PureScript'],\n\t['purs', 'PureScript'],\n\t['python', 'Python'],\n\t['py', 'Python'],\n\t['qsharp', 'Q#'],\n\t['qs', 'Q#'],\n\t['q', 'Q (kdb+ database)'],\n\t['qml', 'QML'],\n\t['qore', 'Qore'],\n\t['r', 'R'],\n\t['racket', 'Racket'],\n\t['rkt', 'Racket'],\n\t['cshtml', 'Razor C#'],\n\t['razor', 'Razor C#'],\n\t['jsx', 'React JSX'],\n\t['tsx', 'React TSX'],\n\t['reason', 'Reason'],\n\t['regex', 'Regex'],\n\t['rego', 'Rego'],\n\t['renpy', \"Ren'py\"],\n\t['rpy', \"Ren'py\"],\n\t['rescript', 'ReScript'],\n\t['res', 'ReScript'],\n\t['rest', 'reST (reStructuredText)'],\n\t['rip', 'Rip'],\n\t['roboconf', 'Roboconf'],\n\t['robotframework', 'Robot Framework'],\n\t['robot', 'Robot Framework'],\n\t['ruby', 'Ruby'],\n\t['rb', 'Ruby'],\n\t['rust', 'Rust'],\n\t['sas', 'SAS'],\n\t['sass', 'Sass (Sass)'],\n\t['scss', 'Sass (SCSS)'],\n\t['scala', 'Scala'],\n\t['scheme', 'Scheme'],\n\t['shell-session', 'Shell session'],\n\t['sh-session', 'Shell session'],\n\t['shellsession', 'Shell session'],\n\t['smali', 'Smali'],\n\t['smalltalk', 'Smalltalk'],\n\t['smarty', 'Smarty'],\n\t['sml', 'SML'],\n\t['smlnj', 'SML'],\n\t['solidity', 'Solidity (Ethereum)'],\n\t['sol', 'Solidity (Ethereum)'],\n\t['solution-file', 'Solution file'],\n\t['sln', 'Solution file'],\n\t['soy', 'Soy (Closure Template)'],\n\t['sparql', 'SPARQL'],\n\t['rq', 'SPARQL'],\n\t['splunk-spl', 'Splunk SPL'],\n\t['sqf', 'SQF: Status Quo Function (Arma 3)'],\n\t['sql', 'SQL'],\n\t['squirrel', 'Squirrel'],\n\t['stan', 'Stan'],\n\t['stata', 'Stata Ado'],\n\t['iecst', 'Structured Text (IEC 61131-3)'],\n\t['stylus', 'Stylus'],\n\t['supercollider', 'SuperCollider'],\n\t['sclang', 'SuperCollider'],\n\t['swift', 'Swift'],\n\t['systemd', 'Systemd configuration file'],\n\t['t4-templating', 'T4 templating'],\n\t['t4-cs', 'T4 Text Templates (C#)'],\n\t['t4', 'T4 Text Templates (C#)'],\n\t['t4-vb', 'T4 Text Templates (VB)'],\n\t['tap', 'TAP'],\n\t['tcl', 'Tcl'],\n\t['tt2', 'Template Toolkit 2'],\n\t['textile', 'Textile'],\n\t['toml', 'TOML'],\n\t['tremor', 'Tremor'],\n\t['trickle', 'Tremor'],\n\t['troy', 'Tremor'],\n\t['turtle', 'Turtle'],\n\t['trig', 'Turtle'],\n\t['twig', 'Twig'],\n\t['typescript', 'TypeScript'],\n\t['ts', 'TypeScript'],\n\t['typoscript', 'TypoScript'],\n\t['tsconfig', 'TypoScript'],\n\t['unrealscript', 'UnrealScript'],\n\t['uscript', 'UnrealScript'],\n\t['uc', 'UnrealScript'],\n\t['uorazor', 'UO Razor Script'],\n\t['uri', 'URI'],\n\t['url', 'URI'],\n\t['v', 'V'],\n\t['vala', 'Vala'],\n\t['vbnet', 'VB.Net'],\n\t['velocity', 'Velocity'],\n\t['verilog', 'Verilog'],\n\t['vhdl', 'VHDL'],\n\t['vim', 'vim'],\n\t['visual-basic', 'Visual Basic'],\n\t['vb', 'Visual Basic'],\n\t['vba', 'Visual Basic'],\n\t['warpscript', 'WarpScript'],\n\t['wasm', 'WebAssembly'],\n\t['web-idl', 'Web IDL'],\n\t['webidl', 'Web IDL'],\n\t['wgsl', 'WGSL'],\n\t['wiki', 'Wiki markup'],\n\t['wolfram', 'Wolfram language'],\n\t['mathematica', 'Wolfram language'],\n\t['nb', 'Wolfram language'],\n\t['wl', 'Wolfram language'],\n\t['wren', 'Wren'],\n\t['xeora', 'Xeora'],\n\t['xeoracube', 'Xeora'],\n\t['xml-doc', 'XML doc (.net)'],\n\t['xojo', 'Xojo (REALbasic)'],\n\t['xquery', 'XQuery'],\n\t['yaml', 'YAML'],\n\t['yml', 'YAML'],\n\t['yang', 'YANG'],\n\t['zig', 'Zig'],\n]);\n","import { readFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport CleanCSS from 'clean-css';\nimport { Cache, getMode, VirtualAssets } from 'ezal';\nimport stylus from 'stylus';\n\nconst base = path.join(__dirname, '../assets/styles/_code.styl');\n\nconst cleaner = new CleanCSS();\n\nclass CodeblockStyle extends VirtualAssets {\n\t#baseCache = new Cache<string>();\n\textra = '';\n\tconstructor() {\n\t\tsuper('/styles/code.css');\n\t\tsuper.updateDependencies([base]);\n\t}\n\tasync build() {\n\t\tlet cache = this.#baseCache.get();\n\t\tif (!cache) {\n\t\t\tconst file = await readFile(base, 'utf8');\n\t\t\tcache = stylus.render(file);\n\t\t\tthis.#baseCache.set(cache);\n\t\t}\n\t\tconst result = this.extra + cache;\n\t\tif (getMode() !== 'build') return result;\n\t\treturn cleaner.minify(result).styles;\n\t}\n\tprotected onDependenciesChanged() {\n\t\tsuper.invalidated();\n\t\tthis.#baseCache.clean();\n\t}\n}\n\nlet asset: CodeblockStyle;\nexport function updateStyles(css: string) {\n\tif (css === asset.extra) return;\n\tasset.extra = css;\n\tasset.invalidated();\n}\n\nexport function initCodeblockStyle() {\n\tasset = new CodeblockStyle();\n}\n","import { transformerColorizedBrackets } from '@shikijs/colorized-brackets';\nimport {\n\ttransformerNotationDiff,\n\ttransformerNotationErrorLevel,\n\ttransformerNotationFocus,\n\ttransformerNotationHighlight,\n\ttransformerNotationWordHighlight,\n\ttransformerStyleToClass,\n} from '@shikijs/transformers';\nimport { ModelOperations } from '@vscode/vscode-languagedetection';\nimport { getMode } from 'ezal';\nimport {\n\ttype CodeblockParsed,\n\ttype CommonPlugin,\n\ttype PluginContext,\n\tplugins,\n\tutils,\n} from 'ezal-markdown';\nimport {\n\ttype BundledLanguage,\n\ttype BundledTheme,\n\tcreateHighlighter,\n\ttype HighlighterGeneric,\n\ttype ShikiTransformer,\n} from 'shiki';\nimport { getThemeConfig } from '../../config';\nimport { LANGUAGE_MAP } from './data';\nimport { updateStyles } from './style';\n\nconst PATTERN_CLASS = /class=\"([A-Za-z0-9 -]+)\"/;\nconst PATTERN_EMPTY_LINE =\n\t/\\n<span class=\"line\">(<span class=\"mtk-\\d+\"><\\/span>)?<\\/span><\\/code><\\/pre>$/;\n\nconst modelOperations = new ModelOperations();\n\nasync function getLang(code: string, lang?: string): Promise<string> {\n\tif (lang) return lang;\n\tconst result = await modelOperations.runModel(code);\n\treturn result.toSorted((a, b) => b.confidence - a.confidence)[0].languageId;\n}\n\nlet shiki: HighlighterGeneric<BundledLanguage, BundledTheme>;\nconst shikiClassName: string[] = [];\nconst toClass = transformerStyleToClass({\n\tclassReplacer(name) {\n\t\tlet i = shikiClassName.indexOf(name);\n\t\tif (i === -1) {\n\t\t\ti = shikiClassName.length;\n\t\t\tshikiClassName.push(name);\n\t\t}\n\t\treturn `mtk-${i}`;\n\t},\n});\nconst transformers: ShikiTransformer[] = [\n\ttransformerNotationDiff(),\n\ttransformerNotationHighlight(),\n\ttransformerNotationWordHighlight(),\n\ttransformerNotationFocus(),\n\ttransformerNotationErrorLevel(),\n\ttransformerColorizedBrackets(),\n\ttoClass,\n];\n\nasync function highlighter(\n\tcode: string,\n\tlang?: string,\n): Promise<[html: string, lang: string]> {\n\tlang = await getLang(code, lang);\n\tlet loadedLanguage = lang;\n\ttry {\n\t\tawait shiki.loadLanguage(lang as any);\n\t} catch {\n\t\tloadedLanguage = 'plain';\n\t}\n\tconst theme = getThemeConfig().markdown?.codeBlockTheme;\n\tconst html = await shiki.codeToHtml(code, {\n\t\tlang: loadedLanguage,\n\t\tthemes: {\n\t\t\tlight: theme?.light.name ?? 'light-plus',\n\t\t\tdark: theme?.dark.name ?? 'dark-plus',\n\t\t},\n\t\ttransformers,\n\t});\n\tif (getMode() === 'serve') updateStyles(toClass.getCSS());\n\treturn [html, lang];\n}\n\nconst { $ } = utils;\n\nfunction packager(html: string, lang: string, extra: string): string {\n\tconst name = LANGUAGE_MAP.get(lang) ?? lang;\n\tlet mtk = '';\n\thtml = html\n\t\t.replace(PATTERN_CLASS, (_, className: string) => {\n\t\t\tconst classes = className.split(' ');\n\t\t\tconst result: string[] = ['shiki'];\n\t\t\tfor (const name of classes) {\n\t\t\t\tif (name.startsWith('has-')) result.push(name);\n\t\t\t\telse if (name.startsWith('mtk-')) mtk = name;\n\t\t\t}\n\t\t\treturn `class=\"${result.join(' ')}\"`;\n\t\t})\n\t\t.replace(PATTERN_EMPTY_LINE, '</code></pre>');\n\treturn $('figure', {\n\t\tclass: ['code', 'rounded', mtk],\n\t\thtml: [\n\t\t\t$('figcaption', {\n\t\t\t\tclass: ['sticky', 'rounded'],\n\t\t\t\thtml: [\n\t\t\t\t\t$('code', name),\n\t\t\t\t\textra,\n\t\t\t\t\t$('button', { class: ['link', 'icon-copy'], attr: { title: '复制代码' } }),\n\t\t\t\t],\n\t\t\t}),\n\t\t\thtml,\n\t\t],\n\t});\n}\n\nconst origin = plugins.codeblock();\n\nasync function render(\n\t{ code, lang, children }: CodeblockParsed,\n\t{ shared, counter }: PluginContext,\n): Promise<string> {\n\tcounter.count(code);\n\tshared.codeblock = true;\n\tconst result = await highlighter(code, lang);\n\treturn packager(result[0], result[1], children?.html ?? '');\n}\n\nconst indented: CommonPlugin<'block', CodeblockParsed> = {\n\t...origin.indentedCodeblock,\n\trender,\n};\n\nconst fenced: CommonPlugin<'block', CodeblockParsed> = {\n\t...origin.fencedCodeblock,\n\trender,\n};\n\nexport async function codeblock() {\n\tconst theme = getThemeConfig().markdown?.codeBlockTheme;\n\tshiki = await createHighlighter({\n\t\tthemes: theme ? [theme.light, theme.dark] : ['light-plus', 'dark-plus'],\n\t\tlangs: [],\n\t});\n\treturn { indented, fenced };\n}\n\nexport function setupCodeblockStyle() {\n\tupdateStyles(toClass.getCSS());\n}\n","import {\n\ttype CommonPlugin,\n\ttype Parsed,\n\ttype ParsedChild,\n\tutils,\n} from 'ezal-markdown';\n\ninterface FoldParsed extends Parsed {\n\tchildren: [summary: ParsedChild, details: ParsedChild];\n}\n\nconst PATTERN_START = /(?<=^|\\n) {0,3}(\\+{3,}) {0,3}(\\S.*)\\n/;\n\nconst { $ } = utils;\n\nexport const fold: CommonPlugin<'block', FoldParsed> = {\n\tname: 'fold',\n\ttype: 'block',\n\torder: 0,\n\tpriority: 0,\n\tstart: PATTERN_START,\n\tparse(source, { md }) {\n\t\tconst matched = source.match(PATTERN_START);\n\t\tif (!matched) return;\n\t\tconst size = matched[1].length;\n\t\tconst summary = matched[2];\n\t\tconst pattern = new RegExp(`(?<=^|\\\\n) {0,3}\\\\+{${size}}\\\\s*(\\\\n|$)`);\n\t\tconst endMatched = source.match(pattern);\n\t\tconst end = endMatched?.index ?? Infinity;\n\t\tconst rawEnd = end + (endMatched?.[0].length ?? 0);\n\t\tconst raw = source.slice(0, rawEnd);\n\t\tconst details = raw.slice(matched[0].length, end);\n\t\treturn {\n\t\t\traw,\n\t\t\tchildren: [md(summary, 'inline'), md(details, 'block')],\n\t\t};\n\t},\n\trender({ children: [summary, details] }) {\n\t\treturn $('details', {\n\t\t\tclass: 'rounded',\n\t\t\thtml: [\n\t\t\t\t$('summary', { class: ['rounded', 'sticky'], html: summary.html }),\n\t\t\t\t$('div', { class: 'sticky-content', html: details.html }),\n\t\t\t],\n\t\t});\n\t},\n};\n","import {\n\ttype ASTPlugin,\n\ttype CommonPlugin,\n\tLinkNode,\n\ttype Parsed,\n\ttype ParsedChild,\n\tParsedNode,\n\ttype RendererPlugin,\n\tutils,\n} from 'ezal-markdown';\n\ninterface LinkParsed extends Parsed {\n\tid: string;\n\tlabel: string;\n}\n\ninterface SourceParsed extends Parsed {\n\tchildren: ParsedChild[];\n\tid: [label: string, id: string][];\n}\n\nconst { eachLine, $ } = utils;\n\nconst PATTERN_SOURCE_START = /(?<=^|\\n)\\[\\^.*?\\]:/;\nconst PATTERN_SOURCE_BEGIN = /^\\[(.*?)\\]:/;\nconst PATTERN_SOURCE_INDENT = /^(\\t| {1,4})/;\n\nconst render: RendererPlugin<'inline', LinkParsed> = {\n\tname: 'footnote',\n\ttype: 'inline',\n\trender({ id, label }, { counter }) {\n\t\tcounter.count(label);\n\t\treturn $(\n\t\t\t'sup',\n\t\t\t$('a', {\n\t\t\t\tclass: 'footnote',\n\t\t\t\tattr: { href: id },\n\t\t\t\tcontent: label,\n\t\t\t}),\n\t\t);\n\t},\n};\n\nconst ast: ASTPlugin<'inline', LinkNode> = {\n\tname: 'footnote-ast',\n\ttype: 'inline',\n\tphase: 'post',\n\tpriority: -1,\n\tparse(root) {\n\t\tfor (const child of root.entires().toArray()) {\n\t\t\tif (!(child instanceof LinkNode)) continue;\n\t\t\tif (child.label?.[0] !== '^') continue;\n\t\t\tif (child.raw?.length !== child.label.length + 2) continue;\n\t\t\tconst id = child.destination;\n\t\t\tconst label = child.raw.slice(2, -1);\n\t\t\tchild.before(\n\t\t\t\tnew ParsedNode('footnote', 'inline', { id, label } as LinkParsed),\n\t\t\t);\n\t\t\tchild.remove();\n\t\t}\n\t},\n\tverifyNode: (_): _ is LinkNode => false,\n\trender: () => '',\n};\n\nconst source: CommonPlugin<'block', SourceParsed> = {\n\tname: 'footnote-source',\n\ttype: 'block',\n\torder: 0,\n\tpriority: 0,\n\tstart: PATTERN_SOURCE_START,\n\tparse(source, { anchors, refMap, md }) {\n\t\tconst contents: string[] = [];\n\t\tconst id: [string, string][] = [];\n\t\tlet current = '';\n\t\tlet raw = '';\n\t\tlet indentState: boolean | null = null;\n\t\tfor (const [line] of eachLine(source)) {\n\t\t\tconst matched = line.match(PATTERN_SOURCE_BEGIN);\n\t\t\t// 首行\n\t\t\tif (matched) {\n\t\t\t\tif (matched[1][0] !== '^') break;\n\t\t\t\tif (raw) contents.push(current);\n\t\t\t\tconst label = matched[1].slice(1);\n\t\t\t\tconst hash = anchors.register(label);\n\t\t\t\tid.push([label, hash]);\n\t\t\t\trefMap.set(matched[1], { destination: `#${hash}` });\n\t\t\t\tcurrent = line.slice(matched[0].length);\n\t\t\t\traw += line;\n\t\t\t\tindentState = null;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// 懒续行\n\t\t\tconst indent = PATTERN_SOURCE_INDENT.test(line);\n\t\t\tconst empty = line.trim().length === 0;\n\t\t\t// 第二行设置缩进状态:若第二行为空则后续必须缩进\n\t\t\tif (indentState === null) indentState = indent || empty;\n\t\t\t// 若无需缩进或之前存在无缩进行,且当前行为空行则结束\n\t\t\tif (!indentState && empty) break;\n\t\t\t// 若需要缩进而为缩进则结束\n\t\t\tif (indentState && !indent) break;\n\t\t\t// 若不为空行且未缩进则设置为无缩进\n\t\t\tif (!(empty || indent)) indentState = false;\n\t\t\tcurrent += line;\n\t\t\traw += line;\n\t\t}\n\t\tif (id.length !== contents.length) contents.push(current);\n\t\tconst children = contents.map((content) =>\n\t\t\tmd(content, { skipParagraphWrapping: true, maxLevel: 'block' }),\n\t\t);\n\t\treturn { raw, id, children };\n\t},\n\trender({ id, children }, { counter }) {\n\t\tfor (const [label] of id) {\n\t\t\tcounter.count(label);\n\t\t}\n\t\tfor (const child of children) {\n\t\t\tcounter.count(child.raw);\n\t\t}\n\t\treturn $(\n\t\t\t'dl',\n\t\t\tchildren.flatMap((child, i) => [\n\t\t\t\t$('dt', { content: id[i][0], id: id[i][1] }),\n\t\t\t\t$('dd', child.html),\n\t\t\t]),\n\t\t);\n\t},\n};\n\nexport const footnote = { source, ast, render };\n","import { escapeHTML, type Page, URL } from 'ezal';\nimport {\n\ttype ASTPlugin,\n\tImageNode,\n\tParagraph,\n\ttype Parsed,\n\tParsedNode,\n\ttype RendererPlugin,\n\tutils,\n} from 'ezal-markdown';\nimport mime from 'mime-types';\nimport { getImageInfo, type ImageInfo } from '../image';\n\nconst { $ } = utils;\n\nfunction img(\n\tinfo: ImageInfo | null,\n\tsrc: string,\n\talt: string,\n\ttitle?: string,\n): string {\n\treturn $('img', {\n\t\tattr: {\n\t\t\tsrc: URL.for(src),\n\t\t\talt,\n\t\t\twidth: info?.metadata?.width,\n\t\t\theight: info?.metadata?.height,\n\t\t\tloading: 'lazy',\n\t\t\ttitle,\n\t\t},\n\t\tstyle: { $imgColor: info?.metadata?.color },\n\t});\n}\n\ninterface ImageParsed extends Parsed {\n\ttitle?: string;\n\talt: string;\n\turl: string;\n}\n\nfunction renderImage(\n\turl: string,\n\talt: string,\n\ttitle: string | undefined,\n\tpage: Page,\n): string {\n\tconst info = getImageInfo(URL.resolve(page.url, url));\n\tif (!info?.rule) return img(info, url, alt, title);\n\tconst html: string[] = info.rule.slice(0, -1).map((ext) =>\n\t\t$('source', {\n\t\t\tattr: { srcset: URL.extname(url, `.opt${ext}`), type: mime.lookup(ext) },\n\t\t}),\n\t);\n\thtml.push(img(info, URL.extname(url, info.rule.at(-1)!), alt, title));\n\treturn $('picture', html);\n}\n\nconst blockRender: RendererPlugin<'block', ImageParsed> = {\n\tname: 'image',\n\ttype: 'block',\n\trender({ title, url, alt }, { shared, counter }) {\n\t\tconst page = shared.page as any as Page;\n\t\tconst html: string[] = [renderImage(url, alt, title, page)];\n\t\thtml.push($('figcaption', { content: alt }));\n\t\tcounter.count(alt);\n\t\treturn $('figure', { class: 'image', html });\n\t},\n};\n\nconst block: ASTPlugin<'inline', ParsedNode> = {\n\tname: 'image-post',\n\ttype: 'inline',\n\tphase: 'post',\n\tpriority: -1,\n\tparse(root) {\n\t\tif (!(root instanceof Paragraph)) return;\n\t\tif (root.size !== 1) return;\n\t\tconst child = root.child(0);\n\t\tif (!(child instanceof ImageNode)) return;\n\t\tconst alt = child\n\t\t\t.entires()\n\t\t\t.map((node) => node.raw ?? '')\n\t\t\t.toArray()\n\t\t\t.join('');\n\t\tconst image = new ParsedNode('image', 'block', {\n\t\t\traw: child.raw ?? '',\n\t\t\ttitle: child.title,\n\t\t\talt: escapeHTML(alt),\n\t\t\turl: child.destination,\n\t\t} as ImageParsed);\n\t\troot.before(image);\n\t\troot.remove();\n\t},\n\tverifyNode: (_node): _node is ParsedNode => false,\n\trender: () => '',\n};\n\nconst inline: ASTPlugin<'inline', ImageNode> = {\n\tname: 'image',\n\ttype: 'inline',\n\tphase: 'post',\n\tpriority: 1,\n\tparse() {},\n\tverifyNode(node): node is ImageNode {\n\t\treturn node instanceof ImageNode;\n\t},\n\trender(node, { shared }) {\n\t\tconst page = shared.page as any as Page;\n\t\tconst { destination, title } = node;\n\t\tconst alt = escapeHTML(\n\t\t\tnode\n\t\t\t\t.entires()\n\t\t\t\t.map((node) => node.html)\n\t\t\t\t.toArray()\n\t\t\t\t.join(''),\n\t\t);\n\t\treturn renderImage(destination, alt, title, page);\n\t},\n};\n\nexport const image = { block, blockRender, inline };\n","import { type CommonPlugin, type Parsed, utils } from 'ezal-markdown';\n\ninterface KbdParsed extends Parsed {\n\tkey: string;\n}\n\nconst PATTERN = /{{\\S+?}}/;\n\nconst { $ } = utils;\n\nexport const kbd: CommonPlugin<'inline', KbdParsed> = {\n\tname: 'kbd',\n\ttype: 'inline',\n\torder: 0,\n\tpriority: 0,\n\tstart: PATTERN,\n\tparse(source) {\n\t\tconst matched = source.match(PATTERN);\n\t\tif (!matched) return;\n\t\treturn { raw: matched[0], key: matched[0].slice(2, -2) };\n\t},\n\trender({ key }, { counter }) {\n\t\tcounter.count(key);\n\t\treturn $('kbd', { content: key });\n\t},\n};\n","import { URL } from 'ezal';\nimport { type ASTPlugin, LinkNode, utils } from 'ezal-markdown';\n\nconst PATTERN_ABSOLUTE_LINK = /^[a-z][a-z0-9+.-]*:|^\\/\\//;\n\nconst { $ } = utils;\n\nexport const link: ASTPlugin<'inline', LinkNode> = {\n\tname: 'link',\n\ttype: 'inline',\n\tphase: 'post',\n\tpriority: 1,\n\tparse() {},\n\tverifyNode(node): node is LinkNode {\n\t\treturn node instanceof LinkNode;\n\t},\n\trender(node) {\n\t\tconst html = [...node.entires().map((node) => node.html)];\n\t\tconst target = PATTERN_ABSOLUTE_LINK.test(node.destination)\n\t\t\t? '_blank'\n\t\t\t: undefined;\n\t\treturn $('a', {\n\t\t\tattr: { href: URL.for(node.destination), target, title: node.title },\n\t\t\thtml,\n\t\t});\n\t},\n};\n","import { URL } from 'ezal';\nimport { type CommonPlugin, type Parsed, utils } from 'ezal-markdown';\n\ninterface Link {\n\thref: string;\n\ticon?: string;\n\ttitle: string;\n\tsubtitle?: string;\n}\n\ninterface LinksParsed extends Parsed {\n\tlinks: Link[];\n}\n\nconst PATTERN_ALL = /(?<=^|\\n)@@\\n.*?\\n@@(\\n|$)/s;\nconst PATTERN_EACH = /(?<=^|\\n)@ ?([^@\\n].*\\n){2,3}/g;\nconst PATTERN_WHITESPACE = /\\s+/;\n\nconst { $ } = utils;\n\nexport const links: CommonPlugin<'block', LinksParsed> = {\n\tname: 'links',\n\ttype: 'block',\n\torder: 0,\n\tpriority: 0,\n\tstart: PATTERN_ALL,\n\tparse(source) {\n\t\tconst matched = source.match(PATTERN_ALL);\n\t\tif (!matched) return;\n\t\tconst raw = matched[0];\n\t\tconst links = [\n\t\t\t...raw.matchAll(PATTERN_EACH).map<Link>((matched) => {\n\t\t\t\tconst lines = matched[0].split('\\n');\n\t\t\t\tconst args = lines[0].slice(1).trim().split(PATTERN_WHITESPACE);\n\t\t\t\treturn {\n\t\t\t\t\thref: args[0],\n\t\t\t\t\ticon: args[1],\n\t\t\t\t\ttitle: lines[1],\n\t\t\t\t\tsubtitle: lines[2],\n\t\t\t\t};\n\t\t\t}),\n\t\t];\n\t\treturn { raw, links };\n\t},\n\trender({ links }, { counter }) {\n\t\tconst html = links.map<string>(({ href, icon, title, subtitle }) => {\n\t\t\tconst html: string[] = [$('i', { class: ['icon-link'] })];\n\t\t\tif (icon) {\n\t\t\t\thtml.push(\n\t\t\t\t\t$('img', { class: 'rounded', attr: { src: URL.for(icon), alt: title } }),\n\t\t\t\t);\n\t\t\t}\n\t\t\thtml.push($('div', { class: 'link-title', content: title }));\n\t\t\tcounter.count(title);\n\t\t\tif (subtitle) {\n\t\t\t\thtml.push($('div', { content: subtitle }));\n\t\t\t\tcounter.count(subtitle);\n\t\t\t}\n\t\t\treturn $('a', { class: 'rounded', html, attr: { href: URL.for(href) } });\n\t\t});\n\t\treturn $('div', { class: 'links', html });\n\t},\n};\n","import { type CommonPlugin, type Parsed, utils } from 'ezal-markdown';\n\ninterface MermaidParsed extends Parsed {\n\tcontent: string;\n}\n\nconst PATTERN_START = /(?<=^|\\n)( {0,3})(`{3,}|~{3,})\\s*mermaid\\s*(?=$|\\n)/i;\n\nconst { $ } = utils;\n\nexport const mermaid: CommonPlugin<'block', MermaidParsed> = {\n\tname: 'mermaid',\n\ttype: 'block',\n\torder: 0,\n\tpriority: 1,\n\tstart: PATTERN_START,\n\tparse(source) {\n\t\tconst start = source.match(PATTERN_START);\n\t\tif (!start) return;\n\t\tconst fenceLength = start[2].length;\n\t\tconst fenceType = start[2][0];\n\t\tconst startOffset = start[0].length;\n\t\tconst end = source\n\t\t\t.slice(startOffset)\n\t\t\t.match(\n\t\t\t\tnew RegExp(`(?<=\\n)( {0,3})${fenceType}{${fenceLength},}[ \\t]*(\\n|$)`),\n\t\t\t);\n\t\tconst raw = source.slice(\n\t\t\t0,\n\t\t\tend?.index ? startOffset + end.index + end[0].length : undefined,\n\t\t);\n\t\tconst content = raw.slice(\n\t\t\tstartOffset + 1,\n\t\t\tend?.index ? startOffset + end.index : undefined,\n\t\t);\n\t\treturn { raw, content };\n\t},\n\trender({ content }, { shared, counter }) {\n\t\tcounter.count(content);\n\t\tshared.mermaid = true;\n\t\treturn $('pre', { class: 'mermaid', content });\n\t},\n};\n","import {\n\ttype CommonPlugin,\n\ttype Parsed,\n\ttype ParsedChild,\n\tutils,\n} from 'ezal-markdown';\n\ninterface NoteParsed extends Parsed {\n\ttype: string;\n\ttitle: string;\n\tchildren: ParsedChild;\n}\n\nconst PATTERN_START = /(?<=^|\\n) {0,3}(!{3,}) ?(info|tip|warn|danger)(.*)\\n/;\n\nconst { $ } = utils;\n\nconst NOTE_TITLE: Record<string, string> = {\n\tinfo: '注意',\n\ttip: '提示',\n\twarn: '警告',\n\tdanger: '危险',\n};\n\nexport const note: CommonPlugin<'block', NoteParsed> = {\n\tname: 'note',\n\ttype: 'block',\n\torder: 0,\n\tpriority: 0,\n\tstart: PATTERN_START,\n\tparse(source, { md }) {\n\t\tconst matched = source.match(PATTERN_START);\n\t\tif (!matched) return;\n\t\tconst size = matched[1].length;\n\t\tconst type = matched[2];\n\t\tlet title = matched[3]?.trim();\n\t\tif (!title) title = NOTE_TITLE[type];\n\t\tconst pattern = new RegExp(`(?<=^|\\\\n) {0,3}!{${size}}\\\\s*(\\\\n|$)`);\n\t\tconst endMatched = source.match(pattern);\n\t\tconst end = endMatched?.index ?? Infinity;\n\t\tconst rawEnd = end + (endMatched?.[0].length ?? 0);\n\t\tconst raw = source.slice(0, rawEnd);\n\t\tconst content = raw.slice(matched[0].length, end);\n\t\treturn { raw, type, title, children: md(content, 'block') };\n\t},\n\trender({ type, title, children }) {\n\t\treturn $('div', {\n\t\t\tclass: ['note', `note-${type}`],\n\t\t\thtml: [$('p', [$('i', { class: `icon-${type}` }), title]), children.html],\n\t\t});\n\t},\n};\n","import { plugins, utils } from 'ezal-markdown';\n\nconst { $ } = utils;\n\nconst origin = plugins.table();\n\nexport const table: typeof origin = {\n\t...origin,\n\trender(source, context, options) {\n\t\treturn $('div', {\n\t\t\tclass: ['table', 'rounded'],\n\t\t\tattr: { tabindex: '0' },\n\t\t\thtml: origin.render(source, context, options) as string,\n\t\t});\n\t},\n};\n","import {\n\ttype CommonPlugin,\n\ttype Parsed,\n\ttype ParsedChild,\n\tutils,\n} from 'ezal-markdown';\n\ninterface TabsParsed extends Parsed {\n\tchildren: [tab: ParsedChild, content: ParsedChild][];\n\tid: string[];\n}\n\nconst PATTERN_START = /(?<=^|\\n) {0,3}(:{3,}) {0,3}\\S/;\n\nconst { $ } = utils;\n\nexport const tabs: CommonPlugin<'block', TabsParsed, number> = {\n\tname: 'tabs',\n\ttype: 'block',\n\torder: 0,\n\tpriority: 0,\n\tstart: PATTERN_START,\n\tparse(source, { anchors, md }) {\n\t\tconst size = source.match(PATTERN_START)?.[1].length ?? 0;\n\t\tif (!size) return;\n\n\t\tconst pattern = new RegExp(`(?<=^|\\\\n) {0,3}:{${size}}(.*)(\\\\n|$)`);\n\t\tconst children: TabsParsed['children'] = [];\n\t\tconst id: TabsParsed['id'] = [];\n\n\t\tlet matched = source.match(pattern);\n\t\tlet offset = 0;\n\t\twhile (matched) {\n\t\t\toffset += matched[0].length;\n\t\t\tif (matched[1].trim().length === 0) break;\n\t\t\tconst tab = md(matched[1], 'inline');\n\t\t\tmatched = source.slice(offset).match(pattern);\n\t\t\tconst next = (matched?.index ?? Infinity) + offset;\n\t\t\tconst content = md(source.slice(offset, next), 'block');\n\t\t\toffset = next;\n\t\t\tid.push(anchors.register('tab'));\n\t\t\tchildren.push([tab, content]);\n\t\t}\n\n\t\tif (children.length === 0) return;\n\n\t\treturn { raw: source.slice(0, offset), children, id };\n\t},\n\trender({ children, id }, context) {\n\t\tconst name = `tabs-${context.self}`;\n\t\tcontext.self++;\n\t\tconst nav = children.map(([tab], i) =>\n\t\t\t$('label', {\n\t\t\t\tattr: { for: id[i] },\n\t\t\t\thtml: [\n\t\t\t\t\t$('input', { attr: { type: 'radio', name, checked: i === 0 }, id: id[i] }),\n\t\t\t\t\ttab.html,\n\t\t\t\t],\n\t\t\t}),\n\t\t);\n\t\tconst content = children.map(([_, content], i) =>\n\t\t\t$('div', { class: i === 0 ? 'active' : undefined, html: content.html }),\n\t\t);\n\t\treturn $('div', {\n\t\t\tclass: ['tabs', 'rounded'],\n\t\t\thtml: [\n\t\t\t\t$('div', { class: ['tab-nav', 'rounded', 'sticky'], html: nav }),\n\t\t\t\t$('div', { class: ['tab-content', 'sticky-content'], html: content }),\n\t\t\t],\n\t\t});\n\t},\n\tcontext: () => 0,\n};\n","import type { CommonPlugin, Parsed, PluginLogger } from 'ezal-markdown';\nimport katex, { type StrictFunction } from 'katex';\n\nconst PATTERN_INLINE = /(?<=\\s|\\W|^)(?<!\\$)(\\$\\$?)(.+?)(\\1)(?!\\$)(?=\\s|\\W|$)/;\nconst PATTERN_BLOCK = /(?<=^|\\n) {0,3}\\$\\$.*?\\$\\$\\s*(\\n|$)/s;\n\nconst katexErrorHandler =\n\t(logger: PluginLogger): StrictFunction =>\n\t(errorCode, errorMsg, token) => {\n\t\tswitch (errorCode) {\n\t\t\tcase 'unknownSymbol':\n\t\t\tcase 'unicodeTextInMathMode':\n\t\t\tcase 'mathVsTextUnits':\n\t\t\tcase 'newLineInDisplayMode':\n\t\t\tcase 'htmlExtension':\n\t\t\t\tlogger.warn(`${errorCode}: ${errorMsg}`, token);\n\t\t\t\tbreak;\n\t\t\tcase 'commentAtEnd':\n\t\t\t\tlogger.error(`${errorCode}: ${errorMsg}`, token);\n\t\t\t\tbreak;\n\t\t}\n\t\treturn false;\n\t};\n\ninterface TexParsed extends Parsed {\n\ttex: string;\n}\n\nconst inline: CommonPlugin<'inline', TexParsed> = {\n\tname: 'tex',\n\ttype: 'inline',\n\torder: 0,\n\tpriority: 0,\n\tstart: PATTERN_INLINE,\n\tparse(source) {\n\t\tconst matched = source.match(PATTERN_INLINE);\n\t\tif (!matched) return;\n\t\tconst raw = matched[0];\n\t\tconst tex = matched[2];\n\t\treturn { raw, tex };\n\t},\n\trender({ tex }, { logger, shared, counter }) {\n\t\tshared.tex = true;\n\t\tcounter.count(tex);\n\t\treturn katex.renderToString(tex, {\n\t\t\toutput: 'html',\n\t\t\tthrowOnError: false,\n\t\t\tstrict: katexErrorHandler(logger),\n\t\t});\n\t},\n};\n\nconst block: CommonPlugin<'block', TexParsed> = {\n\tname: 'tex',\n\ttype: 'block',\n\torder: 0,\n\tpriority: 0,\n\tstart: PATTERN_BLOCK,\n\tparse(source) {\n\t\tconst matched = source.match(PATTERN_BLOCK);\n\t\tif (!matched) return;\n\t\tconst raw = matched[0];\n\t\tconst start = raw.indexOf('$$');\n\t\tconst end = raw.lastIndexOf('$$');\n\t\tconst tex = raw.slice(start + 2, end).trim();\n\t\treturn { raw, tex };\n\t},\n\trender({ tex }, { logger, shared, counter }) {\n\t\tshared.tex = true;\n\t\tcounter.count(tex);\n\t\treturn katex.renderToString(tex, {\n\t\t\tdisplayMode: true,\n\t\t\toutput: 'html',\n\t\t\tthrowOnError: false,\n\t\t\tstrict: katexErrorHandler(logger),\n\t\t});\n\t},\n};\n\nexport const tex = { inline, block };\n","import { fs, Logger, type PageHandler } from 'ezal';\nimport {\n\ttype CommonPlugin,\n\tEzalMarkdown,\n\textractFrontmatter,\n\tplugins,\n} from 'ezal-markdown';\nimport { getThemeConfig } from '../config';\nimport { codeblock } from './codeblock';\nimport { fold } from './fold';\nimport { footnote } from './footnote';\nimport { image } from './image';\nimport { kbd } from './kbd';\nimport { link } from './link';\nimport { links } from './links';\nimport { mermaid } from './mermaid';\nimport { note } from './note';\nimport { table } from './table';\nimport { tabs } from './tabs';\nimport { tex } from './tex';\n\nconst logger = new Logger('markdown');\n\nconst renderer = new EzalMarkdown();\nrenderer.logger = {\n\tdebug(data) {\n\t\tlogger.debug(`[${data.name}]`, data.message, data.errObj);\n\t},\n\tinfo(data) {\n\t\tlogger.log(`[${data.name}]`, data.message, data.errObj);\n\t},\n\twarn(data) {\n\t\t// HACK: 忽略因脚注引起的警告\n\t\tif (\n\t\t\tdata.name === 'link-reference-define' &&\n\t\t\tdata.message.includes('label ^')\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tlogger.warn(`[${data.name}]`, data.message, data.errObj);\n\t},\n\terror(data) {\n\t\tlogger.error(`[${data.name}]`, data.message, data.errObj);\n\t},\n};\n\nconst setext: CommonPlugin<'block'> = {\n\tname: 'setext-heading',\n\ttype: 'block',\n\torder: 0,\n\tpriority: 0,\n\tstart: () => null,\n\tparse: () => null,\n\trender: () => '',\n};\n\nexport async function markdownPageHandler(): Promise<PageHandler> {\n\trenderer.set(\n\t\tplugins.heading({ shiftLevels: true }),\n\t\timage,\n\t\ttable,\n\t\tawait codeblock(),\n\t\tfootnote,\n\t\ttex,\n\t\ttabs,\n\t\tnote,\n\t\tfold,\n\t\tkbd,\n\t\tlinks,\n\t\tsetext,\n\t\tlink,\n\t\tmermaid,\n\t);\n\treturn {\n\t\texts: '.md',\n\t\tasync parser(src) {\n\t\t\tconst file = await fs.readFile(src);\n\t\t\tif (file instanceof Error) return file;\n\t\t\tconst frontmatter = await extractFrontmatter(file);\n\t\t\tlet data = frontmatter?.data as Record<string, any>;\n\t\t\tif (typeof data !== 'object') data = {};\n\t\t\tconst content = file.slice(frontmatter?.raw.length ?? 0);\n\t\t\treturn { content, data };\n\t\t},\n\t\tasync renderer(content, page) {\n\t\t\tconst config = getThemeConfig();\n\t\t\tconst result = await renderer.renderHTML(content, {\n\t\t\t\tlineBreak: config.markdown?.lineBreak,\n\t\t\t\tshared: { page } as any,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\thtml: result.html,\n\t\t\t\tdata: result.context,\n\t\t\t};\n\t\t},\n\t};\n}\n","import { VirtualPage } from 'ezal';\n\nexport function init404Page() {\n\tnew VirtualPage({ id: '404', src: '/404.html', layout: '404' });\n}\n","import { Article, VirtualPage } from 'ezal';\nimport type { ArchivePage, ArchivePageData } from '../../layouts/context';\nimport { compareByDate } from '../utils';\n\nlet indexPage: ArchivePage;\nconst years = new Map<number, number>();\n\nfunction getArticles(year: number): Article[] {\n\treturn Article.getAll()\n\t\t.filter((article) => article.date.year === year)\n\t\t.toSorted(compareByDate);\n}\n\nfunction createIndex() {\n\tconst data: ArchivePageData = { years, getArticles };\n\tindexPage = new VirtualPage({\n\t\tid: 'archive',\n\t\tsrc: '/archive/',\n\t\tlayout: 'archive',\n\t\ttitle: '归档',\n\t\tdata,\n\t}) as ArchivePage;\n}\n\nlet scanned = false;\nexport function updateArchivePage(_any?: any) {\n\tif (!scanned && _any) return;\n\tscanned = true;\n\tif (!indexPage) createIndex();\n\tconst newYears = new Map<number, number>();\n\tfor (const article of Article.getAll()) {\n\t\tconst year = article.date.year;\n\t\tlet count = newYears.get(year);\n\t\tif (count === undefined) count = 0;\n\t\tcount++;\n\t\tnewYears.set(year, count);\n\t}\n\tyears.clear();\n\tfor (const [year, count] of newYears) {\n\t\tyears.set(year, count);\n\t}\n\tindexPage.invalidated();\n}\n","import { Category, VirtualPage } from 'ezal';\nimport type { CategoryPage, CategoryPageData } from '../../layouts/context';\n\nconst categories = new Map<Category, CategoryPage>();\n\nfunction createPage(category: Category): CategoryPage {\n\tconst id = `category/${category.path.join('/')}`;\n\tconst data: CategoryPageData = { category };\n\treturn new VirtualPage({\n\t\tid,\n\t\tsrc: `/${id}/`,\n\t\ttitle: `分类:${category.name}`,\n\t\tlayout: 'category',\n\t\tdata,\n\t}) as CategoryPage;\n}\n\nlet scanned = false;\nexport function updateCategoryPage(_any?: any) {\n\tif (!scanned && _any) return;\n\tscanned = true;\n\tfor (const [category, page] of categories.entries().toArray()) {\n\t\tif (!category.destroyed) continue;\n\t\tpage.destroy();\n\t\tcategories.delete(category);\n\t}\n\tfor (const category of Category.getAll()) {\n\t\tif (categories.has(category)) continue;\n\t\tcategories.set(category, createPage(category));\n\t}\n}\n","import { Article, VirtualPage } from 'ezal';\nimport type { HomePage, HomePageData } from '../../layouts/context';\nimport { getThemeConfig } from '../config';\nimport { compareByDate } from '../utils';\n\nconst pages: HomePage[] = [];\n\nfunction getArticles(index: number): Article[] {\n\tconst pre = getThemeConfig().home?.articlesPrePage ?? 10;\n\tconst offset = index * pre;\n\treturn Article.getAll()\n\t\t.toSorted(compareByDate)\n\t\t.slice(offset, offset + pre);\n}\n\nfunction getPages() {\n\treturn pages;\n}\n\nfunction createPage(index: number): HomePage {\n\tconst i = String(index + 1);\n\tconst data: HomePageData = { index, getPages, getArticles };\n\treturn new VirtualPage({\n\t\tid: index ? `${i}/` : '',\n\t\tsrc: `/${index ? `${i}/` : ''}`,\n\t\tlayout: 'home',\n\t\tdata,\n\t}) as HomePage;\n}\n\nlet scanned = false;\nexport function updateHomePage(article?: Article) {\n\tif (!scanned && article) return;\n\tscanned = true;\n\tconst pre = getThemeConfig().home?.articlesPrePage ?? 10;\n\tconst count = Math.ceil(Math.max(Article.getAll().length / pre, 1));\n\tif (count > pages.length) {\n\t\tfor (let i = pages.length; i < count; i++) {\n\t\t\tpages.push(createPage(i));\n\t\t}\n\t} else if (count < pages.length) {\n\t\tfor (const page of pages.splice(count)) {\n\t\t\tpage.destroy();\n\t\t}\n\t}\n\tfor (const page of pages) {\n\t\tpage.invalidated();\n\t}\n}\n","import { Tag, VirtualPage } from 'ezal';\nimport type { TagPage, TagPageData } from '../../layouts/context';\n\nconst tags = new Map<Tag, TagPage>();\n\nfunction createPage(tag: Tag): TagPage {\n\tconst id = `tag/${tag.name}`;\n\tconst data: TagPageData = { tag };\n\treturn new VirtualPage({\n\t\tid,\n\t\tsrc: `/${id}/`,\n\t\ttitle: `标签:${tag.name}`,\n\t\tlayout: 'tag',\n\t\tdata,\n\t}) as TagPage;\n}\n\nlet scanned = false;\nexport function updateTagPage(_any?: any) {\n\tif (!scanned && _any) return;\n\tscanned = true;\n\tfor (const [tag, page] of tags.entries().toArray()) {\n\t\tif (!tag.destroyed) continue;\n\t\tpage.destroy();\n\t\ttags.delete(tag);\n\t}\n\tfor (const tag of Tag.getAll()) {\n\t\tif (tags.has(tag)) continue;\n\t\ttags.set(tag, createPage(tag));\n\t}\n}\n","import {\n\tArticle,\n\tgetConfig,\n\tgetMode,\n\tLogger,\n\tPage,\n\ttype PromiseOr,\n\tVirtualAssets,\n} from 'ezal';\nimport type { RouteContent } from 'ezal/dist/route';\nimport type * as pagefind from 'pagefind';\n\nconst logger = new Logger('theme:index');\n\nlet index: pagefind.PagefindIndex;\nconst assets = new Map<string, PagefindIndex>();\n\nclass PagefindIndex extends VirtualAssets {\n\tbuffer: Buffer;\n\tconstructor(url: string, buffer: Buffer) {\n\t\tsuper(url);\n\t\tthis.buffer = buffer;\n\t}\n\tbuild(): PromiseOr<RouteContent> {\n\t\treturn this.buffer;\n\t}\n\tprotected onDependenciesChanged() {}\n}\n\n/** 重建索引文件虚拟资源 */\nasync function rebuildIndexFile() {\n\tif (!index) return;\n\tconst { errors, files } = await index.getFiles();\n\tif (errors.length > 0) {\n\t\tif (getMode() === 'build') logger.fatal(errors);\n\t\telse logger.error(errors);\n\t\treturn;\n\t}\n\tconst fileMap = new Map(\n\t\tfiles.map(({ path, content }) => [path, Buffer.from(content)]),\n\t);\n\tfor (const [path, asset] of assets.entries().toArray()) {\n\t\tif (fileMap.has(path)) continue;\n\t\tasset.destroy();\n\t\tassets.delete(path);\n\t}\n\tfor (const [path, buffer] of fileMap) {\n\t\tlet asset = assets.get(path);\n\t\tif (asset) {\n\t\t\tasset.buffer = buffer;\n\t\t\tasset.invalidated();\n\t\t\tcontinue;\n\t\t}\n\t\tasset = new PagefindIndex(path, buffer);\n\t\tassets.set(path, asset);\n\t}\n}\n\n/**\n * 添加页面\n * @description 构建模式下需启用强制才能添加索引\n */\nexport async function addPage(page: Page, force?: boolean): Promise<string[]> {\n\tif (!index) return [];\n\tif (getMode() === 'build' && !force) return [];\n\n\tconst allowIndex = page.data?.index;\n\tif (page instanceof Article) {\n\t\tif (allowIndex === false) return [];\n\t} else if (!allowIndex) return [];\n\n\tconst { errors } = await index.addCustomRecord({\n\t\turl: page.url,\n\t\tcontent: page.content ?? page.markdownContent ?? '',\n\t\tlanguage: getConfig().site.language,\n\t\tmeta: { title: page.title },\n\t});\n\tif (errors.length > 0) logger.error(errors);\n\tif (!force) await rebuildIndexFile();\n\treturn errors;\n}\n\n/** 创建所有页面索引 */\nasync function buildAllIndex(): Promise<string[]> {\n\tconst errors: string[] = [];\n\tfor (const article of Article.getAll()) {\n\t\terrors.push(...(await addPage(article, true)));\n\t}\n\tfor (const page of Page.getAll()) {\n\t\terrors.push(...(await addPage(page, true)));\n\t}\n\treturn errors;\n}\n\n/**\n * 清除并重建索引\n * @description 构建模式下无效\n */\nexport async function rebuildPagefind() {\n\tif (!index) return;\n\tif (getMode() === 'build') return;\n\tawait index.deleteIndex();\n\tconst pagefind = await import('pagefind');\n\tconst response = await pagefind.createIndex();\n\tif (!response.index) throw response.errors;\n\tindex = response.index;\n\tawait buildAllIndex();\n\tawait rebuildIndexFile();\n}\n\n/** 构建 Pagefind */\nexport async function buildPagefind() {\n\tif (!index) throw new Error('Pagefind not initialized');\n\tawait buildAllIndex();\n\tawait rebuildIndexFile();\n}\n\n/**\n * 初始化 PageFind\n * @description 构建模式下不会构建索引\n */\nexport async function initPagefind() {\n\tif (index) return;\n\tconst pagefind = await import('pagefind');\n\tconst response = await pagefind.createIndex();\n\tif (!response.index) throw response.errors;\n\tindex = response.index;\n\tif (getMode() === 'build') return;\n\tawait rebuildPagefind();\n}\n\n/** 停止 PageFind */\nexport async function stopPagefind() {\n\tconst pagefind = await import('pagefind');\n\tawait pagefind.close();\n}\n","import { Article, getConfig, Page, URL, VirtualAssets } from 'ezal';\nimport { SitemapStream } from 'sitemap';\nimport { getThemeConfig } from './config';\n\nfunction getInfo(page: Page): {\n\turl: string;\n\tchangefreq: string;\n\timg?: string;\n} {\n\tlet img = page.data?.cover;\n\tif (img) img = URL.resolve(page.url, img);\n\treturn { url: page.url, changefreq: 'weekly', img };\n}\n\nclass Sitemap extends VirtualAssets {\n\tconstructor() {\n\t\tsuper('/sitemap.xml');\n\t}\n\tbuild() {\n\t\tconst { site } = getConfig();\n\t\tconst stream = new SitemapStream({ hostname: site.domain });\n\n\t\tstream.write({ url: '/' });\n\t\tconst pre = getThemeConfig().home?.articlesPrePage ?? 10;\n\t\tconst count = Math.ceil(Math.max(Article.getAll().length / pre, 1));\n\t\tfor (let i = 2; i <= count; i++) stream.write({ url: `/${i}/` });\n\n\t\tfor (const article of Article.getAll()) {\n\t\t\tif (article.data?.sitemap === false) continue;\n\t\t\tstream.write(getInfo(article));\n\t\t}\n\n\t\tfor (const page of Page.getAll()) {\n\t\t\tif (!page.data?.sitemap) continue;\n\t\t\tstream.write(getInfo(page));\n\t\t}\n\n\t\tstream.end();\n\n\t\treturn stream;\n\t}\n\tprotected onDependenciesChanged() {}\n}\n\nlet asset: Sitemap;\n\nexport function initSitemap() {\n\tasset = new Sitemap();\n}\n\nexport function updateSitemap() {\n\tasset?.invalidated();\n}\n","import path from 'node:path';\nimport esbuild from 'esbuild';\nimport { getMode, type TransformRule } from 'ezal';\n\nexport const scriptTransformRule: TransformRule = {\n\tfrom: '.ts',\n\tto: '.js',\n\tasync transformer(src: string) {\n\t\tconst buildMode = getMode() === 'build';\n\t\tconst {\n\t\t\toutputFiles,\n\t\t\tmetafile: { inputs },\n\t\t} = await esbuild.build({\n\t\t\t// Load\n\t\t\tentryPoints: [src],\n\t\t\tloader: { '.ts': 'ts' },\n\t\t\texternal: ['../pagefind.js'],\n\t\t\t// Output\n\t\t\tbundle: true,\n\t\t\tplatform: 'browser',\n\t\t\tformat: 'iife',\n\t\t\ttarget: 'es2024',\n\t\t\twrite: false,\n\t\t\tmetafile: true,\n\t\t\tsourcemap: buildMode ? false : 'inline',\n\t\t\t// Other\n\t\t\ttreeShaking: buildMode,\n\t\t\tminify: buildMode,\n\t\t});\n\t\tconst cwd = process.cwd();\n\t\tconst result = outputFiles[0].text;\n\t\tconst dependencies = Object.keys(inputs).map((src) => path.join(cwd, src));\n\t\treturn { result, dependencies };\n\t},\n};\n","import path from 'node:path';\nimport CleanCSS from 'clean-css';\nimport { fs, getMode, normalizeError, type TransformRule } from 'ezal';\nimport stylus from 'stylus';\nimport { getThemeConfig, type LinkPageStyles } from '../config';\n\nconst STYLE_CONFIGS: Record<string, () => any> = {\n\t'color.light': () => getThemeConfig().color?.light,\n\t'color.dark': () => getThemeConfig().color?.dark,\n\twaline: () => !!getThemeConfig().waline,\n};\n\nfunction config({ val }: { val: string }) {\n\tif (val in STYLE_CONFIGS) return STYLE_CONFIGS[val]();\n}\n\nfunction linksStyle({ val }: { val: LinkPageStyles }): boolean {\n\tconst styles = getThemeConfig().linkPageStyles;\n\tif (!styles) return true;\n\treturn styles.includes(val);\n}\n\nconst cleaner = new CleanCSS();\n\nexport const styleTransformRule: TransformRule = {\n\tfrom: '.styl',\n\tto: '.css',\n\tasync transformer(src: string) {\n\t\tconst file = await fs.readFile(src);\n\t\tif (file instanceof Error) return file;\n\t\ttry {\n\t\t\tconst renderer = stylus(file, {\n\t\t\t\tpaths: [path.join(src, '..')],\n\t\t\t\tfilename: path.basename(src),\n\t\t\t\tfunctions: { config, linksStyle },\n\t\t\t\t// @ts-expect-error\n\t\t\t\t'include css': true,\n\t\t\t});\n\t\t\tconst dependencies = renderer.deps().map((dep) => {\n\t\t\t\tif (!dep.startsWith('//?/')) return dep;\n\t\t\t\treturn path.normalize(dep.slice(4));\n\t\t\t});\n\t\t\tlet result = renderer.render();\n\t\t\tif (getMode() === 'build') result = cleaner.minify(result).styles;\n\t\t\treturn { result, dependencies };\n\t\t} catch (error) {\n\t\t\treturn normalizeError(error);\n\t\t}\n\t},\n};\n","import path from 'node:path';\nimport type { ThemeConfig as EzalThemeConfig } from 'ezal';\nimport { setThemeConfig, type ThemeConfig } from './config';\nimport { initFeed, updateFeedCategory, updateFeedItem } from './feed';\nimport { imageAddHook, imageRemoveHook, imageUpdateHook } from './image';\nimport { imageDB } from './image/db';\nimport { exeIndexNow } from './index-now';\nimport { layoutConfig } from './layout';\nimport { markdownPageHandler } from './markdown';\nimport { setupCodeblockStyle } from './markdown/codeblock';\nimport { initCodeblockStyle } from './markdown/codeblock/style';\nimport { init404Page } from './page/404';\nimport { updateArchivePage } from './page/archive';\nimport { updateCategoryPage } from './page/category';\nimport { updateHomePage } from './page/home';\nimport { updateTagPage } from './page/tag';\nimport {\n\taddPage,\n\tbuildPagefind,\n\tinitPagefind,\n\trebuildPagefind,\n\tstopPagefind,\n} from './pagefind';\nimport { initSitemap, updateSitemap } from './sitemap';\nimport { scriptTransformRule } from './transform/script';\nimport { styleTransformRule } from './transform/stylus';\n\nexport async function theme(config?: ThemeConfig): Promise<EzalThemeConfig> {\n\tsetThemeConfig(config);\n\timageDB.init();\n\treturn {\n\t\tassetsRoot: path.join(__dirname, '../assets'),\n\t\ttransformRules: [styleTransformRule, scriptTransformRule],\n\t\tlayout: layoutConfig,\n\t\tpageHandlers: [await markdownPageHandler()],\n\t\thooks: {\n\t\t\t'config:after': [initCodeblockStyle],\n\t\t\t'scan:after': [\n\t\t\t\tupdateHomePage,\n\t\t\t\tupdateArchivePage,\n\t\t\t\tupdateCategoryPage,\n\t\t\t\tupdateTagPage,\n\t\t\t\tinit404Page,\n\t\t\t\tinitPagefind,\n\t\t\t\tinitSitemap,\n\t\t\t\tinitFeed,\n\t\t\t],\n\t\t\t'asset:add': [imageAddHook],\n\t\t\t'asset:update': [imageUpdateHook],\n\t\t\t'asset:remove': [imageRemoveHook],\n\t\t\t'build:before:assets-virtual': [\n\t\t\t\tsetupCodeblockStyle,\n\t\t\t\tbuildPagefind,\n\t\t\t\tupdateSitemap,\n\t\t\t],\n\t\t\t'build:after': [stopPagefind, exeIndexNow],\n\t\t\t'article:add': [updateHomePage, updateArchivePage],\n\t\t\t'article:update': [\n\t\t\t\tupdateHomePage,\n\t\t\t\tupdateArchivePage,\n\t\t\t\taddPage,\n\t\t\t\tupdateSitemap,\n\t\t\t\tupdateFeedItem,\n\t\t\t],\n\t\t\t'article:remove': [\n\t\t\t\tupdateHomePage,\n\t\t\t\tupdateArchivePage,\n\t\t\t\trebuildPagefind,\n\t\t\t\tupdateSitemap,\n\t\t\t\tupdateFeedItem,\n\t\t\t],\n\t\t\t'article:build:after': [addPage, updateFeedItem],\n\t\t\t'page:update': [addPage, updateSitemap],\n\t\t\t'page:remove': [rebuildPagefind, updateSitemap],\n\t\t\t'page:build:after': [addPage],\n\t\t\t'category:add': [updateCategoryPage],\n\t\t\t'category:update': [updateCategoryPage, updateFeedCategory],\n\t\t\t'category:remove': [updateCategoryPage, updateFeedCategory],\n\t\t\t'tag:add': [updateTagPage],\n\t\t\t'tag:update': [updateTagPage],\n\t\t\t'tag:remove': [updateTagPage],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
import { Article, Time, URL } from 'ezal';
|
|
2
2
|
import type { Context } from 'ezal-markdown';
|
|
3
3
|
import base from './base';
|
|
4
4
|
import Image from './components/Image';
|
|
5
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
5
6
|
|
|
6
7
|
const { theme } = context;
|
|
7
8
|
const page = context.page as Article;
|
|
@@ -90,6 +91,18 @@ if (related.length > 0) {
|
|
|
90
91
|
);
|
|
91
92
|
} */
|
|
92
93
|
|
|
94
|
+
let outdateTemplate: JSX.Element | undefined;
|
|
95
|
+
if (page.data.outdate) {
|
|
96
|
+
const outdate = Time.parseDate(page.data.outdate.date, page.updated);
|
|
97
|
+
if (outdate) {
|
|
98
|
+
const outdated = outdate.epochMilliseconds <= Temporal.Now.zonedDateTimeISO().epochMilliseconds;
|
|
99
|
+
const classList = ['article-outdate'];
|
|
100
|
+
if (outdated) classList.push('article-outdate-show');
|
|
101
|
+
const time = outdate.toString({ timeZoneName: 'never' });
|
|
102
|
+
outdateTemplate = <div class={classList} data-time={time}>{page.data.outdate.message}</div>
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
93
106
|
export default base(
|
|
94
107
|
<header>
|
|
95
108
|
{page.data.cover ? <Image url={page.data.cover} alt={page.title} /> : null}
|
|
@@ -123,6 +136,7 @@ export default base(
|
|
|
123
136
|
<main>
|
|
124
137
|
{toc}
|
|
125
138
|
<article>
|
|
139
|
+
{outdateTemplate}
|
|
126
140
|
<RawHTML html={page.content} />
|
|
127
141
|
</article>
|
|
128
142
|
</main>,
|
|
@@ -32,6 +32,31 @@ const enableComment =
|
|
|
32
32
|
const waline =
|
|
33
33
|
theme.cdn?.walineCSS ?? 'https://unpkg.com/@waline/client@v3/dist/waline.css';
|
|
34
34
|
|
|
35
|
+
const mermaid =
|
|
36
|
+
theme.cdn?.mermaid ?? 'https://unpkg.com/mermaid@11/dist/mermaid.esm.min.mjs';
|
|
37
|
+
const mermaidScript =
|
|
38
|
+
`import mermaid from '${mermaid}';` +
|
|
39
|
+
// 'window.mermaid = mermaid;' +
|
|
40
|
+
'mermaid.initialize({startOnLoad:false});' +
|
|
41
|
+
`document.addEventListener('DOMContentLoaded', ()=>{` +
|
|
42
|
+
`const media=window?.matchMedia('(prefers-color-scheme: dark)');` +
|
|
43
|
+
`const theme=()=>media?.matches?'dark':'neutral';` +
|
|
44
|
+
'const charts=new Map();' +
|
|
45
|
+
`for(const e of document.querySelectorAll('pre.mermaid')){` +
|
|
46
|
+
'charts.set(e,e.textContent);' +
|
|
47
|
+
'}'+
|
|
48
|
+
'const render=()=>{'+
|
|
49
|
+
'for(const[e,t]of charts){'+
|
|
50
|
+
'e.textContent=t;'+
|
|
51
|
+
`e.removeAttribute('data-processed');`+
|
|
52
|
+
'}' +
|
|
53
|
+
'mermaid.initialize({theme:theme()});' +
|
|
54
|
+
'mermaid.run();' +
|
|
55
|
+
'};'+
|
|
56
|
+
'render();' +
|
|
57
|
+
'media?.addListener(render);' +
|
|
58
|
+
'})';
|
|
59
|
+
|
|
35
60
|
export default (slot?: any) => (
|
|
36
61
|
<head>
|
|
37
62
|
{/* 基本 */}
|
|
@@ -115,6 +140,11 @@ export default (slot?: any) => (
|
|
|
115
140
|
{'renderedData' in page && page.renderedData.shared.codeblock ? (
|
|
116
141
|
<link rel="stylesheet" href={URL.for('styles/code.css')} />
|
|
117
142
|
) : null}
|
|
143
|
+
{'renderedData' in page && page.renderedData.shared.mermaid ? (
|
|
144
|
+
<script type="module">
|
|
145
|
+
<RawHTML html={mermaidScript} />
|
|
146
|
+
</script>
|
|
147
|
+
) : null}
|
|
118
148
|
{/* 额外 */}
|
|
119
149
|
{slot}
|
|
120
150
|
{theme.inject ? <RawHTML html={theme.inject} /> : null}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ezal-theme-example",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"author": "
|
|
3
|
+
"version": "0.0.6",
|
|
4
|
+
"author": "jonnyjonny",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"peerDependencies": {
|
|
9
|
-
"ezal": "^3.0.
|
|
9
|
+
"ezal": "^3.0.2"
|
|
10
10
|
},
|
|
11
11
|
"engines": {
|
|
12
12
|
"node": ">=22"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"shiki": "^3.15.0",
|
|
34
34
|
"sitemap": "^9.0.0",
|
|
35
35
|
"stylus": "^0.64.0",
|
|
36
|
-
"ezal-layout": "^0.0.
|
|
36
|
+
"ezal-layout": "^0.0.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/better-sqlite3": "^7.6.13",
|