-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_lume.ts
102 lines (91 loc) · 2.43 KB
/
_lume.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// deno-lint-ignore-file no-explicit-any
import lume from "@lume";
import codeHighlight from "@lume/plugins/code_highlight.ts";
import feed from "@lume/plugins/feed.ts";
import katex from "@lume/plugins/katex.ts";
import pug from "@lume/plugins/pug.ts";
import toml from "@lume/plugins/toml.ts";
import ventoAutoTrim from "https://deno.land/x/[email protected]/plugins/auto_trim.ts";
const site = lume(
{
src: "src",
dest: "public",
emptyDest: false,
location: new URL("https://char.lt"),
},
{
markdown: {
options: {
linkify: true,
typographer: true,
},
},
vento: {
options: {},
plugins: [ventoAutoTrim()],
},
},
);
site.use(toml());
site.use(
feed({
output: ["/blog.rss", "/blog.json"],
query: "type=blog_post unlisted!=true",
info: {
title: "charlotte som's blog",
description: "thoughts & ideas",
},
items: {
title: "=title",
description: "=excerpt",
},
}),
);
site.use(
codeHighlight({
// @ts-expect-error codeHighlight _does_ merge but doesn't let you provide a Partial<Options>
options: {
ignoreUnescapedHTML: true,
cssSelector: "pre code:not(.hljs-manual)",
},
}),
);
site.use(katex({ options: { displayMode: false } }));
import mdAnchor from "npm:markdown-it-anchor";
import mdFootnote from "npm:markdown-it-footnote";
const customizeMarkdown = (md: any) => {
md.use(mdAnchor, { level: 2 });
md.use(mdFootnote);
// footnote captions without surrounding square brackets
md.renderer.rules.footnote_caption = (tokens: any, idx: any) => {
let n = Number(tokens[idx].meta.id + 1).toString();
if (tokens[idx].meta.subId > 0) {
n += ":" + tokens[idx].meta.subId;
}
return n;
};
};
const md: any = await new Promise((r) => site.hooks.markdownIt(r));
customizeMarkdown(md);
site.use(
pug({
options: {
filters: {
// @ts-ignore: idk what types these are supposed to be. sorry
markdown: (text, options) => md.render(text, options),
},
},
}),
);
site.copy("assets");
site.copy("css");
import prettier from "npm:prettier@3";
site.process([".html"], async (assets) => {
for (const asset of assets) {
asset.content = await prettier.format(asset.content as string, {
parser: "html",
printWidth: 160,
});
}
});
export default site;