mirror of
https://github.com/pheralb/svgl.git
synced 2024-11-10 06:36:56 +08:00
35 lines
859 B
JavaScript
35 lines
859 B
JavaScript
import adapter from '@sveltejs/adapter-auto';
|
|
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
|
|
|
// 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:
|
|
/** @type {import('@sveltejs/kit').Config} */
|
|
const config = {
|
|
extensions: ['.svelte', '.md'],
|
|
preprocess: [vitePreprocess(), mdsvex(mdsvexOptions)],
|
|
kit: {
|
|
adapter: adapter(),
|
|
alias: {
|
|
'@': './src/*'
|
|
}
|
|
}
|
|
};
|
|
|
|
export default config;
|