sql-snippets / svelte.config.js
cfahlgren1's picture
cfahlgren1 HF staff
add node adapter
14c1612
raw
history blame
839 Bytes
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