-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.mjs
More file actions
97 lines (92 loc) · 2.71 KB
/
astro.config.mjs
File metadata and controls
97 lines (92 loc) · 2.71 KB
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
89
90
91
92
93
94
95
96
97
// @ts-check
import cloudflare from "@astrojs/cloudflare";
import mdx from "@astrojs/mdx";
import sitemap from "@astrojs/sitemap";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "astro/config";
import pagefind from "astro-pagefind";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypeFigure from "rehype-figure";
import rehypeImgSize from "rehype-img-size";
import rehypeMermaid from "rehype-mermaid";
import rehypePicture from "rehype-picture";
import rehypeSlug from "rehype-slug";
import { remarkAlert } from "remark-github-blockquote-alert";
import Icons from "unplugin-icons/vite";
import { remarkModifiedTime } from "./remark-modified-time.mjs";
// https://astro.build/config
export default defineConfig({
site: "https://niracler.com",
trailingSlash: "never",
output: "static", // 静态模式:全部预渲染(动态页面需要单独配置 prerender: false)
integrations: [
mdx(),
sitemap({
i18n: {
defaultLocale: "zh",
locales: {
zh: "zh-CN",
en: "en-US",
},
},
}),
pagefind(),
],
adapter: cloudflare({
imageService: "compile",
}),
markdown: {
remarkPlugins: [remarkAlert, remarkModifiedTime],
shikiConfig: {
// 双主题配置:通过 CSS 变量控制,无需 !important
themes: {
light: "github-light",
dark: "catppuccin-mocha",
},
// 禁用默认颜色,让 CSS 完全控制主题切换
defaultColor: false,
},
syntaxHighlight: {
excludeLangs: ["mermaid"],
},
rehypePlugins: [
rehypeSlug,
[
rehypeAutolinkHeadings,
{
behavior: "prepend",
properties: {
class: "anchor-link",
ariaHidden: true,
tabIndex: -1,
},
},
],
[
rehypeMermaid,
{
strategy: "inline-svg", // 服务端渲染为内联 SVG
},
],
rehypePicture,
[rehypeImgSize, { dir: "./public" }],
rehypeFigure,
],
},
i18n: {
defaultLocale: "zh",
locales: ["zh", "en"],
routing: {
prefixDefaultLocale: false,
},
},
vite: {
plugins: [
tailwindcss(),
Icons({
compiler: "astro",
autoInstall: false,
}),
],
},
});