-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.mjs
More file actions
48 lines (48 loc) · 1.69 KB
/
astro.config.mjs
File metadata and controls
48 lines (48 loc) · 1.69 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
import path from "path";
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import Compress from "@playform/compress";
import { defineConfig } from 'astro/config';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
// Markdown 配置================
import remarkMath from "remark-math";
import rehypeSlug from "rehype-slug";
import rehypeKatex from "rehype-katex";
import remarkDirective from "remark-directive";
import { remarkNote, addClassNames } from './src/plugins/markdown.custom'
// Markdown 配置================
import SITE_INFO from './src/config';
import swup from '@swup/astro';
// https://astro.build/config
export default defineConfig({
site: SITE_INFO.Site,
build: { assets: 'vh_static' },
integrations: [swup({
theme: false,
animationClass: "vh-animation-",
containers: [".main-inner>.main-inner-content", '.vh-header>.main'],
smoothScrolling: true,
progress: true,
cache: true,
preload: true,
accessibility: true,
updateHead: true,
updateBodyClass: false,
globalInstance: true
}),
Compress({ CSS: false, Image: true, Action: { Passed: async () => true } }),
sitemap({
changefreq: 'weekly', priority: 0.7, lastmod: new Date(),
// 处理末尾带 / 的 url
serialize: (item) => ({ ...item, url: item.url.endsWith('/') ? item.url.slice(0, -1) : item.url })
}), mdx({ extendMarkdownConfig: false })],
markdown: {
remarkPlugins: [remarkMath, remarkDirective, remarkNote,],
rehypePlugins: [rehypeKatex, rehypeSlug, addClassNames],
syntaxHighlight: 'shiki',
shikiConfig: { theme: 'github-light' },
},
vite: { resolve: { alias: { "@": path.resolve(__dirname, "./src") } } },
server: { host: '0.0.0.0' }
});