-
Notifications
You must be signed in to change notification settings - Fork 0
/
mdsvex.config.js
41 lines (33 loc) · 993 Bytes
/
mdsvex.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
import { defineMDSveXConfig as defineConfig, escapeSvelte } from 'mdsvex';
import rehypeKatexSvelte from 'rehype-katex-svelte';
import remarkMath from 'remark-math';
import { codeToHtml } from 'shiki';
import remarkUnwrapImages from 'remark-unwrap-images';
import remarkToc from 'remark-toc';
import rehypeSlug from 'rehype-slug';
const config = defineConfig({
extensions: ['.svelte.md', '.md', '.svx'],
layout: {
_: './src/default.svelte'
},
highlight: {
highlighter: async (code, lang = 'text') => {
const html = escapeSvelte(
await codeToHtml(code, {
lang: lang,
themes: {
light: 'snazzy-light',
dark: 'vesper'
}
})
);
return `{@html \`${html}\`}`;
}
},
smartypants: {
dashes: 'oldschool'
},
remarkPlugins: [remarkMath, [remarkToc, { tight: true, ordered: true }], remarkUnwrapImages],
rehypePlugins: [rehypeKatexSvelte, rehypeSlug]
});
export default config;