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 { createHighlighter } from "shiki";
const highlighter = await createHighlighter({
themes: ["ayu-dark"],
langs: [
"javascript",
"typescript",
"svelte",
"html",
"css",
"bash",
"json",
"yaml",
"markdown",
"python",
],
});
/** @type {import('mdsvex').MdsvexOptions} */
const mdsvexConfig = {
extensions: [".svx"],
highlight: {
highlighter: async (code, lang) => {
const html = highlighter.codeToHtml(code, {
lang: lang || "text",
theme: "ayu-dark",
});
return `{@html \`${html.replace(/[{}`]/g, (c) => `&#${c.charCodeAt(0)};`)}\`}`;
},
},
};
export default mdsvexConfig;
|