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-03-06 22:04:26 +01: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'],
|
|
|
|
kit: { adapter: adapter() },
|
|
|
|
preprocess: [vitePreprocess(), mdsvex(mdsvexOptions)]
|
2023-11-25 21:31:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export default config
|