87 lines
3.8 KiB
JavaScript
87 lines
3.8 KiB
JavaScript
// @ts-check
|
|
import { defineConfig } from 'astro/config';
|
|
import starlight from '@astrojs/starlight';
|
|
import mdx from '@astrojs/mdx';
|
|
import { unified } from '@astrojs/markdown-remark';
|
|
import remarkMath from 'remark-math';
|
|
import rehypeKatex from 'rehype-katex';
|
|
import remarkMermaid from './src/plugins/remark-mermaid.mjs';
|
|
import rehypeStaticMermaid, { mermaidThemes } from './src/plugins/rehype-mermaid.mjs';
|
|
|
|
export default defineConfig({
|
|
site: 'https://docs.simba-robotics.com',
|
|
redirects: { '/': '/zh-cn/' },
|
|
markdown: {
|
|
processor: unified({
|
|
remarkPlugins: [remarkMath, remarkMermaid],
|
|
rehypePlugins: [rehypeKatex, [rehypeStaticMermaid, { themes: mermaidThemes }]],
|
|
}),
|
|
},
|
|
vite: {
|
|
build: {
|
|
rolldownOptions: {
|
|
onwarn(warning, warn) {
|
|
// Astro 7.3 identifies propagated CSS by the virtual module's query.
|
|
// Rolldown does not understand Astro's generated directive; keep the
|
|
// module and its assets intact and ignore only this specific warning.
|
|
if (
|
|
warning.code === 'MODULE_LEVEL_DIRECTIVE' &&
|
|
warning.message.includes('"use astro:head-inject"') &&
|
|
warning.message.includes('.mdx?astroPropagatedAssets')
|
|
) return;
|
|
warn(warning);
|
|
},
|
|
},
|
|
},
|
|
},
|
|
integrations: [starlight({
|
|
title: 'ΣDOCS',
|
|
disable404Route: true,
|
|
description: 'Simba Robotics / 黑龙江大学 602 创新实验室的工程知识库与校内赛手册。',
|
|
defaultLocale: 'zh-cn',
|
|
locales: {
|
|
'zh-cn': { label: '简体中文', lang: 'zh-CN' },
|
|
en: { label: 'English', lang: 'en' },
|
|
},
|
|
favicon: '/simba/logo.svg',
|
|
logo: {
|
|
light: './public/simba/logo-light.svg',
|
|
dark: './public/simba/logo.svg',
|
|
alt: 'Simba Robotics',
|
|
},
|
|
/*
|
|
* `fonts.generated.css` carries the font stacks and the KaTeX faces. It is
|
|
* produced by `scripts/generate-fonts.mjs` at predev/prebuild, and it must
|
|
* stay last so its stack wins over Starlight's defaults. Note that KaTeX is
|
|
* no longer imported from node_modules: doing so would make the bundler copy
|
|
* the ~1 MB `KaTeX_*.woff2` set into `dist/_astro`.
|
|
*/
|
|
customCss: ['./src/styles/custom.css', './src/styles/fonts.generated.css'],
|
|
components: { Head: './src/components/Head.astro' },
|
|
expressiveCode: {
|
|
styleOverrides: {
|
|
codeFontFamily: 'var(--sl-font)',
|
|
uiFontFamily: 'var(--sl-font)',
|
|
codeBackground: 'var(--sl-color-bg-nav)',
|
|
},
|
|
},
|
|
social: [
|
|
{ icon: 'external', label: 'Simba 战队主站', href: 'https://simba-robotics.com' },
|
|
{ icon: 'github', label: '文档仓库', href: 'https://git.simba-robotics.com/PRAM/simba_docs' },
|
|
],
|
|
sidebar: [
|
|
{ label: '文档首页', translations: { en: 'ΣDOCS home' }, slug: 'index' },
|
|
{ label: '开始阅读', translations: { en: 'Start here' }, items: [{ autogenerate: { directory: 'guides' } }] },
|
|
{ label: '2026 校内赛 · RMIC', translations: { en: 'RMIC 2026' }, items: [{ autogenerate: { directory: 'competition' } }] },
|
|
{ label: '机械架构 · MEST', translations: { en: 'Mechanical & Structure' }, items: [{ autogenerate: { directory: 'mest' } }] },
|
|
{ label: '电传测控 · ELCT', translations: { en: 'Electronics & Control' }, items: [{ autogenerate: { directory: 'elct' } }] },
|
|
{ label: '视觉算法 · VSAG', translations: { en: 'Vision & Algorithms' }, items: [{ autogenerate: { directory: 'vsag' } }] },
|
|
{ label: '宣传筹划 · PRAM', translations: { en: 'Operations & Media' }, items: [{ autogenerate: { directory: 'pram' } }] },
|
|
],
|
|
}),
|
|
// Keep SVG styles executable as style elements, instead of serializing
|
|
// Astro's set:html directive into inert attributes during MDX optimization.
|
|
mdx({ optimize: { ignoreElementNames: ['style'] } }),
|
|
],
|
|
});
|