-
Notifications
You must be signed in to change notification settings - Fork 0
/
svelte.config.js
56 lines (50 loc) · 1.48 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import remarkA11yEmoji from "@fec/remark-a11y-emoji";
import adapter from "@sveltejs/adapter-cloudflare";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
import { mdsvex } from "mdsvex";
import rehypeExternalLinks from "rehype-external-links";
import rehypeSlug from "rehype-slug";
import remarkGfm from "remark-gfm";
import remarkGithub from "remark-github";
import remarkHint from "remark-hint";
import { codeToHtml } from "shiki";
/** @type {import("@sveltejs/kit").Config} */
const config = {
// Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors
extensions: [".svelte", ".md"],
preprocess: [
vitePreprocess(),
mdsvex({
extension: ".md",
layout: "./src/lib/markdown/mdsvex.svelte",
smartypants: {
dashes: "oldschool",
quotes: false,
},
remarkPlugins: [remarkA11yEmoji, remarkGfm, remarkHint, remarkGithub],
rehypePlugins: [rehypeSlug, [rehypeExternalLinks, { target: "_blank" }]],
highlight: {
async highlighter(code, lang) {
const highlightedCode = (
await codeToHtml(code, { theme: "material-theme-palenight", lang })
)
.replace(/<pre ([^>]+)>/, "")
.replace("</pre>", "");
return `<Components.pre rawCode={\`${encodeURIComponent(highlightedCode)}\`} />`;
},
},
}),
],
kit: {
adapter: adapter(),
alias: {
"$lib/components": "src/lib/components",
"$lib/utils": "src/lib/utils",
},
},
vitePlugin: {
inspector: true,
},
};
export default config;