-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathastro.config.mjs
More file actions
76 lines (70 loc) · 2.21 KB
/
Copy pathastro.config.mjs
File metadata and controls
76 lines (70 loc) · 2.21 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
// @ts-check
import { unified } from "@astrojs/markdown-remark";
import mdx from "@astrojs/mdx";
import sitemap from "@astrojs/sitemap";
import svelte from "@astrojs/svelte";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "astro/config";
import rehypeComponents from "rehype-components";
import rehypeKatex from "rehype-katex";
import remarkDirective from "remark-directive";
import remarkMath from "remark-math";
import { AdmonitionComponent } from "./src/plugins/rehype-component-admonition.mjs";
import { GithubCardComponent } from "./src/plugins/rehype-component-github-card.mjs";
import { rehypeWrapTable } from "./src/plugins/rehype-wrap-table.mjs";
import { remarkDetectMath } from "./src/plugins/remark-detect-math.mjs";
import { parseDirectiveNode } from "./src/plugins/remark-directive-rehype.mjs";
import { remarkFixGithubAdmonitions } from "./src/plugins/remark-fix-github-admonitions.js";
// https://astro.build/config
export default defineConfig({
site: "https://aruma.mysqil.com",
output: "static",
trailingSlash: "always",
integrations: [mdx(), sitemap(), svelte()],
// 图片优化配置
image: {
service: {
entrypoint: "astro/assets/services/sharp",
config: {
limitInputPixels: false,
},
},
},
markdown: {
processor: unified({
remarkPlugins: [
remarkMath,
remarkFixGithubAdmonitions,
remarkDirective,
parseDirectiveNode,
remarkDetectMath,
],
rehypePlugins: [
[rehypeKatex, { output: "htmlAndMath" }],
rehypeWrapTable,
[
rehypeComponents,
{
components: {
github: GithubCardComponent,
note: (/** @type {any} */ x, /** @type {any} */ y) =>
AdmonitionComponent(x, y, "note"),
tip: (/** @type {any} */ x, /** @type {any} */ y) =>
AdmonitionComponent(x, y, "tip"),
important: (/** @type {any} */ x, /** @type {any} */ y) =>
AdmonitionComponent(x, y, "important"),
caution: (/** @type {any} */ x, /** @type {any} */ y) =>
AdmonitionComponent(x, y, "caution"),
warning: (/** @type {any} */ x, /** @type {any} */ y) =>
AdmonitionComponent(x, y, "warning"),
},
},
],
],
}),
},
vite: {
// @ts-ignore
plugins: [tailwindcss()],
},
});