-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsvelte.config.js
More file actions
87 lines (79 loc) · 1.94 KB
/
svelte.config.js
File metadata and controls
87 lines (79 loc) · 1.94 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
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
import adapter from '@sveltejs/adapter-vercel';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { escapeSvelte, mdsvex } from 'mdsvex';
import { createHighlighter } from 'shiki';
const theme = 'github-dark';
const highlighter = await createHighlighter({
themes: [theme],
langs: [
'javascript',
'typescript',
'html',
'css',
'json',
'bash',
'php',
'elixir',
'go',
'rust',
'gleam',
'kotlin',
'lua',
'svelte',
'markdown',
'tsx',
'jsx',
'http',
'mermaid',
'sql',
'text',
'diff'
]
});
import * as dvl from 'devlulcas-md';
import relativeImages from 'mdsvex-relative-images';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import rehypeSlug from 'rehype-slug';
const blockQuoteTypes = [
{ prefix: 'tip', className: 'tip' },
{ prefix: 'warning', className: 'warning' },
{ prefix: 'danger', className: 'danger' },
{ prefix: 'info', className: 'info' },
{ prefix: 'success', className: 'success' },
{ prefix: 'note', className: 'note' },
{ prefix: 'important', className: 'important' },
{ prefix: 'caution', className: 'caution' },
{ prefix: 'error', className: 'error' }
];
/** @type {import('mdsvex').MdsvexOptions} */
export const mdsvexOptions = {
extensions: ['.md', '.svx', '.mdx'],
highlight: {
highlighter: async (code, lang = 'text') => {
const html = escapeSvelte(highlighter.codeToHtml(code, { lang, theme }));
return `{@html \`${html}\` }`;
}
},
remarkPlugins: [
relativeImages,
dvl.remarkBetterImages,
[dvl.remarkCustomBlockquotes, { types: blockQuoteTypes }],
dvl.remarkExternalUrl
],
rehypePlugins: [rehypeSlug, [rehypeAutolinkHeadings, { behavior: 'wrap' }]]
};
/** @type {import('@sveltejs/kit').Config} */
const config = {
extensions: ['.svelte', '.svx', '.md'],
preprocess: [vitePreprocess(), mdsvex(mdsvexOptions)],
kit: {
adapter: adapter(),
prerender: {
entries: ['*']
},
alias: {
'$/*': 'src/*'
}
}
};
export default config;