-
Notifications
You must be signed in to change notification settings - Fork 2
/
astro.config.ts
88 lines (85 loc) · 2.38 KB
/
astro.config.ts
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import { defineConfig } from "astro/config";
import react from "@astrojs/react";
import tailwind from "@astrojs/tailwind";
import svelte from "@astrojs/svelte";
import remarkMath from "remark-math";
import rehypeKatex from "rehype-katex";
import rehypeStringify from "rehype-stringify";
import remarkCodeTitle from "remark-code-title";
import remarkParse from "remark-parse";
import remarkStringify from "remark-stringify";
import { rehypePrettyCode } from "rehype-pretty-code";
import { transformerCopyButton } from "@rehype-pretty/transformers";
import { remarkWikiLink, getPermalinks } from "@portaljs/remark-wiki-link";
import yaml from "@rollup/plugin-yaml";
import config from "./src/config";
// FIXME: To use TOML, wait for PR to be merged
export default defineConfig({
integrations: [
react(),
tailwind({
applyBaseStyles: false,
}),
svelte(),
],
vite: {
ssr: { external: ["node:fs"] },
resolve: { alias: { fs: "node:fs" } },
define: {
"process.env.IS_PREACT": JSON.stringify("true"),
},
plugins: [yaml()],
},
prefetch: {
prefetchAll: true,
defaultStrategy: "load",
},
redirects: config.redirects,
markdown: {
gfm: true,
// FIXME: rehypePrettyCode works only if this is set to false
// https://github.com/rehype-pretty/rehype-pretty-code/blob/master/examples/astro/astro.config.ts
syntaxHighlight: "shiki",
shikiConfig: {
theme: (config.codeTheme as any) ?? "one-dark-pro",
},
remarkPlugins: [
remarkParse,
remarkStringify,
remarkCodeTitle,
remarkMath,
[
remarkWikiLink,
{
pathFormat: "obsidian-short",
permalinks: getPermalinks("./src/posts"),
hrefTemplate: (permalink: string) => {
if (permalink.endsWith(".excalidraw")) {
const link = permalink.split("src/posts/").pop();
return `/excalidraw/${link!.split(".excalidraw")[0]}`;
}
return permalink.split("src/posts").pop();
},
},
],
],
rehypePlugins: [
rehypeKatex,
[
rehypePrettyCode,
{
transformers: [
transformerCopyButton({
visibility: "hover",
feedbackDuration: 2_500,
}),
],
},
],
rehypeStringify,
],
remarkRehype: {
allowDangerousHtml: true,
},
},
});