-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocusaurus.config.ts
More file actions
316 lines (293 loc) · 9.25 KB
/
docusaurus.config.ts
File metadata and controls
316 lines (293 loc) · 9.25 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
// 这段代码在Node.js中运行 - 不要在此处使用客户端代码(如浏览器API、JSX等)
// 多平台部署
const getBaseUrl = () => {
// Vercel 生产环境
if(process.env.VERCEL_ENV === 'production') {
return 'https://tech-docusaurus.vercel.app';
}
// Vercel 预览环境
if(process.env.VERCEL) {
return `https://${process.env.VERCEL_URL}`;
}
// 自有存储服务器部署
if(process.env.NODE_ENV === 'production') {
return 'http://172.19.15.18:3000'
}
// Cloudflare Pages 环境
if(process.env.CF_PAGES) {
return process.env.CF_PAGES_URL || 'https://Tech-Docusaurus.pages.dev'
}
// 默认部署
return 'http://localhost:3000'
}
const config: Config = {
title: '技术文档',
tagline: '',
favicon: 'img/favicon.ico',
// Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
// 未来特性flags,请参阅https://docusaurus.io/docs/api/docusaurus-config#future
future: {
v4: true,
// Improve compatibility with the upcoming Docusaurus v4
// 提前准备网站以适应即将到来的 Docusaurus 4 版本。
},
// Set the production url of your site here
// 在这里设置站点的生产url,已在自有服务器、Cloudflare、Vercel进行部署
url: getBaseUrl(),
// Set the /<baseUrl>/ pathname under which your site is served
// 设置你的站点所在的/<baseUrl>/路径名。
// For GitHub pages deployment, it is often '/<projectName>/'
// 对于GitHub页面部署,通常是‘/<projectName>/’。
baseUrl: '/',
// GitHub pages deployment config.
// GitHub页面部署配置。
// If you aren't using GitHub pages, you don't need these.
// 如果你不使用GitHub页面,你不需要这些。
organizationName: 'TSGU-OSC',
// Usually your GitHub org/user name.
// 通常是你的GitHub组织名/用户名。
projectName: 'Tech-Docusaurus',
// Usually your repo name.
// 通常是你的仓库名。
// 关闭文档相关检查1
onBrokenLinks: 'ignore',
// 尽量避免文档中出现空、不完整或失效链接,调试时可适当使用。
// onBrokenMarkdownLinks: 'ignore',
onBrokenAnchors: 'ignore',
onDuplicateRoutes: 'ignore',
// 关闭文档相关检查2
markdown: {
mermaid: false, // 如果有的话
format: 'md', // 使用普通 Markdown 而不是 MDX
},
// Even if you don't use internationalization, you can use this field to set
// 即使不使用国际化,你也可以使用这个字段来设置有用的元数据,如HTML语言。
// useful metadata like html lang. For example, if your site is Chinese, you
// 例如,如果您的网站是中文的,
// may want to replace "en" with "zh-Hans".
// 您就可能需要将“en”替换为“zh-Hans”。
i18n: {
defaultLocale: 'zh-Hans',
locales: ['zh-Hans'],
},
plugins: [
[
// 插件GitHub主页:
// https://github.com/easyops-cn/docusaurus-search-local?tab=readme-ov-file
'@easyops-cn/docusaurus-search-local',
{
// 设置插件语言为中文
language: ["en", "zh"],
// 对搜索文件名进行哈希处理,利于缓存
hashed: true,
// 高亮标签
highlightSearchTermsOnTargetPage: true,
// 启用开发模式索引
// 启用本地索引
forceIgnoreNoIndex: true,
docsDir: 'docs', // 指定文档目录,默认为'docs'
docsRouteBasePath: 'docs', // 文档基础路径为'/docs'
// 开发模式索引文档
indexDocs: true,
// 没有博客,所以设置为false
indexBlog: false,
},
],
],
presets: [
[
'classic',
{
docs: {
sidebarPath: './sidebars.ts',
// Please change this to your repo.
// 请将此处更改为您的仓库。
// Remove this to remove the "edit this page" links.
// 删除下方链接以用于移除“编辑此页”链接。
editUrl:
'https://github.com/TSGU-OSC/TechDoc/tree/master',
// // 关闭文档相关检查3
// remarkPlugins: [], // 清空 remark 插件
// rehypePlugins: [], // 清空 rehype 插件
},
blog: {
// showReadingTime: true,
// feedOptions: {
// type: ['rss', 'atom'],
// xslt: true,
// },
// Please change this to your repo.
// 请将此处修改为您的仓库。
// Remove this to remove the "edit this page" links.
// 删除下方链接以用于移除“编辑此页”链接。
// editUrl:
// 'https://github.com/TSGU-OSC/TechDoc/tree/master',
// Useful options to enforce blogging best practices
// 有助于强制执行博客最佳实践的有用选项
// 关闭文档相关检查4
onInlineTags: 'ignore',
onInlineAuthors: 'ignore',
onUntruncatedBlogPosts: 'ignore',
},
theme: {
customCss: './src/css/custom.css',
},
} satisfies Preset.Options,
],
],
themeConfig: {
// Replace it with your social card.
// 替换为您的专属社交卡片。
// image: 'img/docusaurus-social-card.jpg',
// 格式:image: 'img/docusaurus-social-card.jpg',
colorMode: {
respectPrefersColorScheme: true,
},
docs: {
sidebar: {
// 控制整个文档侧边栏是否默认折叠
// 允许完全隐藏侧边栏
hideable: true,
// 控制侧边栏是否可以折叠,以及默认的折叠状态
// 自动折叠其他分类
autoCollapseCategories: true
},
},
navbar: {
title: '技术文档',
logo: {
alt: 'TSGU-OSC Logo',
src: 'img/logo.svg',
},
items: [
// // 搜索框
// {
// type: 'search',
// position: 'right',
// },
// 导航栏GitHub图标按钮
{
href: 'https://github.com/TSGU-OSC/TechDoc',
position: 'right',
className: 'header-github-link',
'aria-label': 'GitHub repository',
},
// 侧边栏:排序 + 命名调整
{
type: 'doc',
docId: 'Basic-Knowledge/1Overview',
position: 'left',
label: '基础知识',
},
{
type: 'doc',
docId: 'Front-End/NodeJsMarkdown',
position: 'left',
label: '前端',
},
{
type: 'doc',
docId: 'Back-End/C/C',
position: 'left',
label: '后端',
},
{
type: 'doc',
docId: 'AI/Stable_Diffusion',
position: 'left',
label: 'AI',
},
{
type: 'doc',
docId: 'Operation-and-Maintenance/Shell',
position: 'left',
label: '运维',
},
{
type: 'doc',
docId: 'Hacking/README',
position: 'left',
label: 'Hacking'
},
{
type: 'doc',
docId: 'Machine-Learning/README',
position: 'left',
label: '机器学习'
},
{
type: 'doc',
docId: 'Quantum-Computing/README',
position: 'left',
label: '量子计算'
},
{
type: 'doc',
docId: 'Other/How_to_Play_Minecraft_server',
position: 'left',
label: '其他',
},
// 博客
// {to: '/blog', label: 'Blog', position: 'left'},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Docusaurus 官方文档',
href: 'https://docusaurus.io/zh-CN/docs'
},
],
},
{
title: 'Community',
items: [
{
label: 'OpenHarmony 开源鸿蒙',
href: 'https://docs.openharmony.cn/pages/v6.0/zh-cn/OpenHarmony-Overview_zh.md'
},
{
label: 'Ascend 昇腾',
href: 'https://www.hiascend.com/zh/document'
},
{
label: 'RISC-V 开发者社区',
href: 'https://ruyisdk.cn/'
}
],
},
{
title: 'More',
items: [
{
label: '社团官网',
href: 'https://osc.tsguas.cn',
},
{
label: '网站所属:天津中德应用技术大学 - 开源鸿蒙社',
href: 'https://github.com/TSGU-OSC',
},
{
label: '著作者:CapableCCat',
href: 'https://github.com/CapableCCat'
}
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} TSGU-OSC Club. Built with Docusaurus. Made By CapableCCat`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
} satisfies Preset.ThemeConfig,
};
export default config;