-
Notifications
You must be signed in to change notification settings - Fork 0
/
svelte.config.js
85 lines (79 loc) · 2.33 KB
/
svelte.config.js
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
import adapter from '@sveltejs/adapter-static';
import preprocess from 'svelte-preprocess';
import { importAssets } from 'svelte-preprocess-import-assets';
import { mdsvex } from 'mdsvex';
import rehypeSlug from 'rehype-slug';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import rehypeToc from '@jsdevtools/rehype-toc';
import { rehypeAccessibleEmojis } from 'rehype-accessible-emojis';
import rehypeWidont from 'rehype-widont';
import remarkGfm from 'remark-gfm';
import remarkFootnotes from 'remark-footnotes';
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Ensures both .svelte and .md files are treated as components
extensions: ['.svelte', '.md'],
preprocess: [
mdsvex({
// This overrides the default mdsvex extension of .svx
extensions: ['.md'],
// Note: Order matters
rehypePlugins: [
rehypeSlug,
[
rehypeAutolinkHeadings,
{
behavior: 'wrap',
properties: {
className: ['section_heading'],
},
},
],
[
rehypeToc,
{
customizeTOC: (toc) => {
if (toc.children[0].children.length > 0) {
const secondary_list = toc.children[0].children[0].children[1]?.children || [];
// Strip subheadings that start with "NUM. "
secondary_list.forEach((li) => {
const text = li.children[0].children[0];
text.value = text.value.replace(/^\d\.\s*/g, '');
});
return toc;
}
return false;
},
},
],
rehypeAccessibleEmojis,
rehypeWidont,
],
remarkPlugins: [remarkGfm, remarkFootnotes],
}),
importAssets(),
preprocess(),
],
kit: {
adapter: adapter(),
prerender: {
entries: [
'/blog/',
'/blog/page',
'/blog/page/[page]/',
'/blog/archive/',
'/blog/tag/',
'/blog/tags/',
'/blog/tag/[tag]/',
'/blog/tag/[tag]/page/',
'/blog/tag/[tag]/page/[page]/',
'/blog/api/posts.json/',
'/blog/api/posts_for_tags.json/',
'/blog/api/posts/count/',
'/blog/api/posts/page/[page]/',
'/blog/api/rss.xml/',
],
},
},
};
export default config;