-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocusaurus.config.ts
More file actions
171 lines (157 loc) · 4.47 KB
/
docusaurus.config.ts
File metadata and controls
171 lines (157 loc) · 4.47 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
const config: Config = {
title: 'SuperDock开发者文档',
tagline: '无人机自动机场系统',
favicon: 'img/favicon.ico',
// Set the production url of your site here
url: 'https://docs.sb.im',
// Set the /<baseUrl>/ pathname under which your site is served
baseUrl: '/',
// GitHub pages deployment config
organizationName: 'sb-im',
projectName: 'docs',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
// Internationalization
i18n: {
defaultLocale: 'zh-Hans',
locales: ['zh-Hans'],
},
// 启用 Mermaid 图表支持
markdown: {
mermaid: true,
},
themes: ['@docusaurus/theme-mermaid'],
presets: [
[
'classic',
{
docs: {
sidebarPath: './sidebars-api.ts',
routeBasePath: 'api-integration',
editUrl: 'https://github.com/sb-im/docs/tree/main/',
// 侧边栏优化配置
sidebarCollapsible: true,
sidebarCollapsed: true,
// 显示最后更新时间和作者 - 初始版本暂时禁用
showLastUpdateTime: false,
showLastUpdateAuthor: false,
// 面包屑导航
breadcrumbs: true,
// 文档版本控制
includeCurrentVersion: true,
// 自动生成侧边栏优化
async sidebarItemsGenerator({
defaultSidebarItemsGenerator,
...args
}) {
const sidebarItems = await defaultSidebarItemsGenerator(args);
// 可以在这里添加自定义逻辑,比如:
// 1. 过滤草稿文档
// 2. 添加动态生成的 API 文档
// 3. 根据用户权限过滤内容
return sidebarItems;
},
},
blog: false, // 禁用博客功能
theme: {
customCss: './src/css/custom.css',
},
// 启用站点地图
sitemap: {
changefreq: 'weekly',
priority: 0.5,
ignorePatterns: ['/tags/**'],
filename: 'sitemap.xml',
},
} satisfies Preset.Options,
],
],
plugins: [
// 产品介绍文档实例
[
'@docusaurus/plugin-content-docs',
{
id: 'product-intro',
path: 'product-intro-docs',
routeBasePath: 'product-intro',
sidebarPath: './sidebars-product.ts',
editUrl: 'https://github.com/sb-im/docs/tree/main/',
sidebarCollapsible: true,
sidebarCollapsed: true,
showLastUpdateTime: false,
showLastUpdateAuthor: false,
breadcrumbs: true,
},
],
// 安装部署文档实例
[
'@docusaurus/plugin-content-docs',
{
id: 'installation',
path: 'installation-docs',
routeBasePath: 'installation',
sidebarPath: './sidebars-installation.ts',
editUrl: 'https://github.com/sb-im/docs/tree/main/',
sidebarCollapsible: true,
sidebarCollapsed: true,
showLastUpdateTime: false,
showLastUpdateAuthor: false,
breadcrumbs: true,
},
],
],
themeConfig: {
// 全局 UI 配置
colorMode: {
defaultMode: 'light',
disableSwitch: false,
respectPrefersColorScheme: true,
},
navbar: {
title: '文档中心',
logo: {
alt: 'StrawBerry Innovation Logo',
src: 'img/logo.svg',
},
hideOnScroll: true, // 滚动时隐藏导航栏
items: [
{
type: 'docSidebar',
sidebarId: 'tutorialSidebar',
position: 'left',
label: 'API接口',
},
{
href: 'https://github.com/sb-im',
label: 'GitHub',
position: 'right',
},
{
href: 'https://sb.im',
label: '官网',
position: 'right',
},
],
},
// 侧边栏配置
docs: {
sidebar: {
hideable: true, // 允许隐藏侧边栏
autoCollapseCategories: true, // 自动折叠分类
},
},
// footer: {
// style: 'dark',
// copyright: `${new Date().getFullYear()} SuperDock 无人机机场文档中心`,
// },
prism: {
// 代码块保持 Stripe docs 式“深色底”,避免浅色主题下对比不足
theme: prismThemes.nightOwl,
darkTheme: prismThemes.nightOwl,
},
} satisfies Preset.ThemeConfig,
};
export default config;