Spaces:
Running
Running
import adapter from '@sveltejs/adapter-node' | |
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' | |
import { mdsvex, escapeSvelte } from 'mdsvex' | |
import { createHighlighter } from 'shiki' | |
/** @type {import('mdsvex').MdsvexOptions} */ | |
const mdsvexOptions = { | |
extensions: ['.md'], | |
highlight: { | |
highlighter: async (code, lang = 'text') => { | |
const highlighter = await createHighlighter({ | |
themes: ['github-dark'], | |
langs: [ 'sql'] | |
}) | |
await highlighter.loadLanguage('sql') | |
const html = escapeSvelte(highlighter.codeToHtml(code, { lang, theme: 'github-dark' })) | |
return `{@html \`${html}\` }` | |
} | |
}, | |
} | |
/** @type {import('@sveltejs/kit').Config} */ | |
const config = { | |
extensions: ['.svelte', '.md'], | |
preprocess: [vitePreprocess(), mdsvex(mdsvexOptions)], | |
kit: { | |
adapter: adapter() | |
} | |
} | |
export default config |