2023-11-25 21:31:55 +01:00
|
|
|
import adapter from '@sveltejs/adapter-static'
|
2024-03-06 22:04:26 +01:00
|
|
|
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
|
2023-12-17 23:35:11 +01:00
|
|
|
import { mdsvex, escapeSvelte } from 'mdsvex'
|
2024-05-04 16:10:40 +02:00
|
|
|
import { getHighlighter } from 'shiki'
|
2023-12-17 23:35:11 +01:00
|
|
|
import remarkUnwrapImages from 'remark-unwrap-images'
|
|
|
|
import rehypeSlug from 'rehype-slug'
|
|
|
|
|
|
|
|
/** @type {import('mdsvex').MdsvexOptions} */
|
|
|
|
const mdsvexOptions = {
|
|
|
|
extensions: ['.md'],
|
|
|
|
highlight: {
|
|
|
|
highlighter: async (code, lang = 'text') => {
|
2024-03-06 22:04:26 +01:00
|
|
|
const highlighter = await getHighlighter({ theme: 'github-dark' })
|
2023-12-17 23:35:11 +01:00
|
|
|
const html = escapeSvelte(highlighter.codeToHtml(code, { lang }))
|
|
|
|
return `{@html \`${html}\` }`
|
|
|
|
}
|
|
|
|
},
|
|
|
|
remarkPlugins: [remarkUnwrapImages],
|
|
|
|
rehypePlugins: [rehypeSlug]
|
|
|
|
}
|
2023-11-25 21:31:55 +01:00
|
|
|
|
|
|
|
/** @type {import('@sveltejs/kit').Config} */
|
|
|
|
const config = {
|
2023-12-17 23:35:11 +01:00
|
|
|
extensions: ['.svelte', '.md'],
|
2024-05-04 16:10:40 +02:00
|
|
|
kit: {
|
|
|
|
adapter: adapter(),
|
|
|
|
alias: {
|
|
|
|
$components: './src/lib/components'
|
|
|
|
}
|
|
|
|
},
|
2023-12-17 23:35:11 +01:00
|
|
|
preprocess: [vitePreprocess(), mdsvex(mdsvexOptions)]
|
2023-11-25 21:31:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export default config
|