mirror of
https://github.com/pheralb/svgl.git
synced 2025-02-06 15:17:58 +08:00
🔧 Add markdown & extensions config.
This commit is contained in:
parent
84be304cb4
commit
927cbdca6d
@ -1,13 +1,32 @@
|
|||||||
import adapter from '@sveltejs/adapter-auto';
|
import adapter from '@sveltejs/adapter-auto';
|
||||||
import { vitePreprocess } from '@sveltejs/kit/vite';
|
import { vitePreprocess } from '@sveltejs/kit/vite';
|
||||||
|
|
||||||
|
// 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} */
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
const config = {
|
const config = {
|
||||||
preprocess: vitePreprocess(),
|
extensions: ['.svelte', '.md'],
|
||||||
|
preprocess: [vitePreprocess(), mdsvex(mdsvexOptions)],
|
||||||
kit: {
|
kit: {
|
||||||
adapter: adapter(),
|
adapter: adapter(),
|
||||||
alias: {
|
alias: {
|
||||||
'@': './src/*',
|
'@': './src/*'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user