-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.mts
73 lines (68 loc) · 1.84 KB
/
astro.config.mts
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
import { defineConfig, getViteConfig } from "astro/config";
import image from "@astrojs/image";
import mdx from "@astrojs/mdx";
import sitemap from "@astrojs/sitemap";
import vue from "@astrojs/vue";
import tailwind from "@astrojs/tailwind";
import postcssPatch from "./plugins/postcss";
import remarkDirective from "remark-directive";
import { visit } from "unist-util-visit";
import { h } from "hastscript";
import { config } from "dotenv";
import compress from "astro-compress";
config();
// https://astro.build/config
export default defineConfig({
integrations: [
postcssPatch(),
image(),
mdx(),
sitemap(),
vue(),
tailwind(),
compress(),
],
base: process.env.BASE_URL,
site:
process.env.BUILD_MODE === "production"
? "https://juergenie.github.io"
: undefined,
vite: {
base: process.env.BASE_URL,
ssr: {
external: ["svgo"],
},
},
markdown: {
shikiConfig: {
// theme: "css-variables",
wrap: true,
},
remarkPlugins: [
"remark-gfm",
"remark-smartypants",
remarkDirective,
() => (root) => {
visit(root, (node) => {
if (
node.type === "textDirective" ||
node.type === "leafDirective" ||
node.type === "containerDirective"
) {
const data = (node.data ??= {});
// let hast: ReturnType<typeof h>;
// if (node.name === "tip") {
// const { type, ...attr } = node.attributes;
// hast = h(`div.${[node.name, type ?? "info"].join(".")}`, attr);
// } else {
// hast = h(node.name, node.attributes);
// }
const hast = h(node.name, node.attributes);
data.hName = hast.tagName;
data.hProperties = hast.properties;
}
});
},
],
},
});