theme/libs/registry/astro.config.mjs
2025-05-11 00:27:03 +08:00

44 lines
1.1 KiB
JavaScript

// astro.config.mjs
import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import react from '@astrojs/react';
// import sitemap from '@astrojs/sitemap';
import pkgs from './package.json';
import tailwindcss from '@tailwindcss/vite';
const isDev = process.env.NODE_ENV === 'development';
export default defineConfig({
// ...
// site: 'https://kevisual.xiongxiao.me/root/astro/',
base: pkgs.basename,
markdown: {
// 适用于 MDX 和普通 Markdown 的配置
syntaxHighlight: 'shiki',
shikiConfig: {
theme: 'nord',
},
remarkPlugins: [
'remark-gfm', // GitHub Flavored Markdown
['remark-toc', { headings: ['h2', 'h3'] }], // 目录生成
],
rehypePlugins: [
'rehype-slug', // 为标题添加 ID
'rehype-autolink-headings', // 为标题添加链接
],
},
integrations: [
mdx(),
react(), //
// sitemap(), // sitemap must be site has a domain
],
vite: {
plugins: [tailwindcss()],
define: {
BASE_NAME: JSON.stringify(pkgs.basename),
DEV_SERVER: JSON.stringify(isDev),
},
},
});