svgl/svelte.config.js

35 lines
859 B
JavaScript
Raw Normal View History

2023-03-15 05:08:22 +08:00
import adapter from '@sveltejs/adapter-auto';
2023-12-17 01:07:44 +08:00
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
2023-03-15 05:08:22 +08:00
2023-12-14 07:42:17 +08:00
// Extensions:
import { mdsvex, escapeSvelte } from 'mdsvex';
import shiki from 'shiki';
// Markdown config:
/** @type {import('mdsvex').MdsvexOptions} */
const mdsvexOptions = {
extensions: ['.md'],
highlight: {
highlighter: async (code, lang = 'text') => {
const highlighter = await shiki.getHighlighter({ theme: 'vitesse-dark' });
const html = escapeSvelte(highlighter.codeToHtml(code, { lang }));
return `{@html \`${html}\` }`;
}
}
};
// Svelte config:
2023-03-15 05:08:22 +08:00
/** @type {import('@sveltejs/kit').Config} */
const config = {
2023-12-14 07:42:17 +08:00
extensions: ['.svelte', '.md'],
preprocess: [vitePreprocess(), mdsvex(mdsvexOptions)],
2023-03-15 19:29:15 +08:00
kit: {
2023-03-19 22:53:31 +08:00
adapter: adapter(),
alias: {
2023-12-14 07:42:17 +08:00
'@': './src/*'
2023-03-19 22:53:31 +08:00
}
2023-03-15 19:29:15 +08:00
}
2023-03-15 05:08:22 +08:00
};
export default config;