2023-03-15 05:08:22 +08:00
|
|
|
import adapter from '@sveltejs/adapter-auto';
|
|
|
|
import { vitePreprocess } from '@sveltejs/kit/vite';
|
|
|
|
|
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;
|