hyprland-website/svelte.config.js

30 lines
894 B
JavaScript
Executable File

import adapter from '@sveltejs/adapter-static'
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
import { mdsvex, escapeSvelte } from 'mdsvex'
import {getHighlighter} from 'shiki'
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') => {
const highlighter = await getHighlighter({ theme: 'github-dark' })
const html = escapeSvelte(highlighter.codeToHtml(code, { lang }))
return `{@html \`${html}\` }`
}
},
remarkPlugins: [remarkUnwrapImages],
rehypePlugins: [rehypeSlug]
}
/** @type {import('@sveltejs/kit').Config} */
const config = {
extensions: ['.svelte', '.md'],
kit: { adapter: adapter() },
preprocess: [vitePreprocess(), mdsvex(mdsvexOptions)]
}
export default config