-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmdsvex.config.js
35 lines (31 loc) · 1002 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
import { defineMDSveXConfig as defineConfig, escapeSvelte } from 'mdsvex';
import remarkMath from 'remark-math';
import shiki from 'shiki';
import rehypeKatex from 'rehype-katex-svelte';
import addClasses from 'rehype-add-classes';
import toc from 'rehype-toc';
import rehypeSlug from 'rehype-slug';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
const config = defineConfig({
extensions: ['.svelte.md', '.md', '.svx'],
smartypants: {
dashes: 'oldschool'
},
highlight: {
highlighter: async (code, lang = 'text') => {
const highlighter = await shiki.getHighlighter({ theme: 'monokai' });
const html = escapeSvelte(highlighter.codeToHtml(code, { lang }));
return `{@html \`${html}\` }`;
}
},
remarkPlugins: [remarkMath],
rehypePlugins: [
[rehypeKatex, { fleqn: true, throwOnError: false }],
[addClasses, { pre: 'bg-white' }],
// [rehypeSlug, {}],
[rehypeAutolinkHeadings, {}],
// [toc, {}]
],
layout: './src/mdsvex.svelte'
});
export default config;