astro-yukunhh-blog/astro.config.mjs
yukun-hh 12dd13a76f feat: init Astro blog with wikilinks, KaTeX and local search
- Astro 5 static blog, zero runtime JS
- Obsidian wikilink remark plugin (slug matches Astro content collection)
- KaTeX math rendering, local search, TOC, archives, tags
- 5 posts on math/physics/ML topics
- deploy scripts for nginx + certbot + rsync
2026-08-14 00:19:33 +08:00

38 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';
import remarkWikilinks from './src/remark-wikilinks.mjs';
// https://astro.build/config
export default defineConfig({
site: 'https://sausagetoast.cloud',
// 构建产物目录nginx 指向此目录)
build: {
format: 'directory',
},
// 不使用 Astro 图片优化(环境无法编译 sharp用 noop 服务兜底
image: {
service: { entrypoint: 'astro/assets/services/noop' },
},
integrations: [
mdx(),
sitemap({
filter: (page) => !page.includes('/draft'),
}),
],
markdown: {
// 代码高亮:淡蓝底 + 柔和色调
shikiConfig: {
themes: {
light: 'catppuccin-latte',
dark: 'catppuccin-latte',
},
wrap: true,
},
// 数学公式:$...$ 行内,$$...$$ 块级,用 KaTeX 渲染
remarkPlugins: [remarkMath, remarkWikilinks],
rehypePlugins: [[rehypeKatex, { throwOnError: false, strict: false, output: 'html' }]],
},
});