-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsvelte.config.js
More file actions
62 lines (58 loc) · 1.66 KB
/
svelte.config.js
File metadata and controls
62 lines (58 loc) · 1.66 KB
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
import adapter from '@sveltejs/adapter-static'
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
import { escapeSvelte, mdsvex } from 'mdsvex'
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
import rehypeKatexSvelte from 'rehype-katex-svelte'
import rehypeSlug from 'rehype-slug'
import remarkMath from 'remark-math'
import remarkToc from 'remark-toc'
import remarkUnwrapImages from 'remark-unwrap-images'
import { createHighlighter } from 'shiki'
const highlighter = await createHighlighter({
themes: ['poimandres'],
langs: [
'javascript',
'typescript',
'bash',
'python',
'svelte',
'sh',
'xml',
'jsx',
],
})
const mdsvexOptions = {
extensions: ['.md'],
highlight: {
highlighter: async (code, lang = 'text') => {
const html = escapeSvelte(
highlighter.codeToHtml(code, { lang, theme: 'poimandres' })
)
return `{@html \`${html}\`}`
},
},
remarkPlugins: [
remarkMath,
remarkUnwrapImages,
[remarkToc, { tight: true, maxDepth: 3 }],
],
rehypePlugins: [rehypeKatexSvelte, rehypeSlug, rehypeAutolinkHeadings],
}
/** @type {import('@sveltejs/kit').Config} */
const config = {
extensions: ['.svelte', '.md'],
preprocess: [mdsvex(mdsvexOptions), vitePreprocess()],
kit: {
adapter: adapter({
pages: 'build',
assets: 'build',
fallback: undefined,
precompress: false,
}),
prerender: {
crawl: true,
entries: ['*', '/rss.xml', '/robots.txt'],
},
},
}
export default config