-
Notifications
You must be signed in to change notification settings - Fork 0
/
svelte.config.js
33 lines (31 loc) · 973 Bytes
/
svelte.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import adapter from "@sveltejs/adapter-static"
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"
import fs from "fs"
import { escapeSvelte, mdsvex } from "mdsvex"
import { getHighlighter } from "shiki"
/** @type {import('@sveltejs/kit').Config} */
const config = {
extensions: [".svelte", ".md"],
preprocess: [
vitePreprocess(),
mdsvex({
extension: ".md",
highlight: {
highlighter: async (code, lang = "text") => {
const theme = JSON.parse(fs.readFileSync("./static/fonts/monokai-pro.json", "utf-8"))
const highlighter = await getHighlighter({
theme,
langs: ["html", "css", "javascript", "typescript", "svelte", "solidity"],
})
const html = escapeSvelte(highlighter.codeToHtml(code, { theme, lang }))
return `{@html \`${html}\` }`
},
},
}),
],
kit: {
adapter: adapter(),
alias: { $: "./src" },
},
}
export default config