diff --git a/svelte.config.js b/svelte.config.js index 2881f85..16dc685 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -3,7 +3,7 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; // Extensions: import { mdsvex, escapeSvelte } from 'mdsvex'; -import shiki from 'shiki'; +import { getHighlighter } from 'shiki'; // Markdown config: /** @type {import('mdsvex').MdsvexOptions} */ @@ -11,8 +11,12 @@ 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 })); + const highlighter = await getHighlighter({ + themes: ['vitesse-dark'], + langs: ['javascript', 'typescript', 'bash', 'json'] + }); + await highlighter.loadLanguage('javascript', 'typescript', 'bash'); + const html = escapeSvelte(highlighter.codeToHtml(code, { lang, theme: 'vitesse-dark' })); return `{@html \`${html}\` }`; } }