配置选项
本文档详细介绍了 Tiebo 项目的各种配置选项。
Astro 配置
Section titled “Astro 配置”export default defineConfig({ integrations: [ starlight({ title: 'Tiebo', description: '温暖学术风格的文档站点', }) ]});sidebar: [ { label: '分组名称', collapsed: false, // true: 折叠, false: 展开 items: [ // 分组内容 ] }]sidebar: [ { label: '主分组', collapsed: false, items: [ { label: '子分组', collapsed: true, items: [ { label: '页面标题', slug: 'path/to/page' } ] } ] }]自动生成目录
Section titled “自动生成目录”{ label: '自动生成', collapsed: true, autogenerate: { directory: 'docs/api', collapsed: false // 子目录的折叠状态 }}CSS 变量
Section titled “CSS 变量”:root { /* 色彩系统 */ --color-primary: #8B4513; --color-secondary: #D2691E; --color-accent: #CD853F;
/* 字体系统 */ --font-family-body: 'Source Serif Pro', serif; --font-family-heading: 'Playfair Display', serif; --font-family-mono: 'JetBrains Mono', monospace;
/* 间距系统 */ --spacing-xs: 0.25rem; --spacing-sm: 0.5rem; --spacing-md: 1rem; --spacing-lg: 1.5rem; --spacing-xl: 2rem;}[data-theme='dark'] { --color-primary: #DEB887; --color-background: #0D0A09; --color-text-primary: #F5E6D3;}Markdown 配置
Section titled “Markdown 配置”数学公式支持
Section titled “数学公式支持”markdown: { remarkPlugins: [remarkMath], rehypePlugins: [[rehypeKatex, { // KaTeX 配置 macros: { "\\RR": "\\mathbb{R}" }, trust: true, strict: "warn" }]]}Front Matter 配置
Section titled “Front Matter 配置”每个 Markdown 文件支持以下配置:
---title: 页面标题description: 页面描述template: splash # 可选:splash, pagesidebar: order: 1 # 侧边栏排序 label: 自定义标签---PUBLIC_SITE_URL=https://yoursite.comPUBLIC_GITHUB_REPO=username/repo{ "scripts": { "dev": "astro dev", "build": "astro build", "preview": "astro preview", "astro": "astro" }}Vercel
Section titled “Vercel”{ "buildCommand": "npm run build", "outputDirectory": "dist", "installCommand": "npm install"}Netlify
Section titled “Netlify”[build] publish = "dist" command = "npm run build"
[build.environment] NODE_VERSION = "18"export default defineConfig({ image: { domains: ['example.com'], format: ['webp', 'avif'] }});export default defineConfig({ vite: { build: { rollupOptions: { output: { manualChunks: { vendor: ['astro'] } } } } }});ESLint 配置
Section titled “ESLint 配置”{ "extends": [ "astro", "plugin:@typescript-eslint/recommended" ], "rules": { "no-console": "warn" }}Prettier 配置
Section titled “Prettier 配置”{ "semi": true, "singleQuote": false, "tabWidth": 2, "trailingComma": "es5"}通过合理配置这些选项,可以打造出符合需求的文档站点。