-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocusaurus.config.ts
More file actions
402 lines (384 loc) · 13.7 KB
/
docusaurus.config.ts
File metadata and controls
402 lines (384 loc) · 13.7 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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
import { themes as prismThemes } from 'prism-react-renderer';
import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
const config: Config = {
title: '笔记本',
// tagline: 'This\'s a Knowledge Base',
favicon: 'img/favicon.png',
headTags: [
{
tagName: 'meta',
attributes: {
name: 'algolia-site-verification',
content: '2DEE65D225182147',
},
},
],
// Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
future: {
v4: true, // Improve compatibility with the upcoming Docusaurus v4
},
// Set the production url of your site here
url: 'https://ituknown.org',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',
trailingSlash: true, // 这里要配置尾斜杠, 否则 algolia 爬虫会失败
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
// organizationName: 'ituknown', // Usually your GitHub org/user name.
// projectName: 'website', // Usually your repo name.
// 引用链接不存在, 直接报错
onBrokenLinks: 'throw',
i18n: {
defaultLocale: 'zh',
locales: ['zh'],
},
themes: ['@docusaurus/theme-mermaid'],
markdown: {
format: 'mdx',
mermaid: true,
emoji: false,
anchors: {
maintainCase: true,
},
hooks: {
// 引用链接不存在, 直接报错
onBrokenMarkdownLinks: 'throw',
onBrokenMarkdownImages: 'throw',
},
},
presets: [
[
'classic',
{
docs: false, // 禁用默认文档插件(默认文档插件id=default)
blog: {
blogSidebarTitle: 'Recent posts', // 侧边栏标题
blogSidebarCount: 'ALL', // 侧边栏显示 Blog 数量
showReadingTime: true, // 显示阅读时间
remarkPlugins: [remarkMath], // 启用 katex
rehypePlugins: [rehypeKatex], // 启用 katex
onInlineTags: 'throw', // 内联不存在的 TAG 直接抛出异常
onInlineAuthors: 'throw', // 内联不存在的作者 直接抛出异常
onUntruncatedBlogPosts: 'throw', // 如果文档没设置 <!-- truncate --> 直接抛出异常
},
sitemap: {
changefreq: 'weekly', // 页面更改频率
priority: 0.5, // 默认优先级
filename: 'sitemap.xml', // 生成的文件名
},
theme: {
customCss: './src/css/custom.css',
},
} satisfies Preset.Options,
],
],
// 启用 Katex
// https://docusaurus.io/docs/markdown-features/math-equations
stylesheets: [
{
// Katex 样式
// https://katex.org/docs/browser
href: 'https://cdn.jsdelivr.net/npm/katex@0.16.25/dist/katex.min.css',
type: 'text/css',
integrity: 'sha384-WcoG4HRXMzYzfCgiyfrySxx90XSl2rxY5mnVY5TwtWE6KLrArNKn0T/mOgNL0Mmi',
crossorigin: 'anonymous',
},
],
// 自定义文档插件实例
plugins: [
[
// FFmpeg 文档实例
'@docusaurus/plugin-content-docs',
{
id: 'ffmpeg', // 插件ID
path: 'docs/ffmpeg', // 文档所在目录
routeBasePath: 'ffmpeg', // URL路由,例如: 域名/ffmpeg
sidebarPath: './sidebars/ffmpeg.ts', // 侧边栏目录解析
showLastUpdateTime: false, // 最近更新时间
remarkPlugins: [remarkMath], // 启用 katex
rehypePlugins: [rehypeKatex], // 启用 katex
},
], [
// Linux 文档实例
'@docusaurus/plugin-content-docs',
{
id: 'linux',
path: 'docs/system/linux',
routeBasePath: 'system/linux',
sidebarPath: './sidebars/system/linux.ts',
showLastUpdateTime: false,
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
], [
// Windows 文档实例
'@docusaurus/plugin-content-docs',
{
id: 'windows',
path: 'docs/system/windows',
routeBasePath: 'system/windows',
sidebarPath: './sidebars/system/windows.ts',
showLastUpdateTime: false,
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
], [
// Java 文档实例
'@docusaurus/plugin-content-docs',
{
id: 'java',
path: 'docs/jvm/java',
routeBasePath: 'jvm/java',
sidebarPath: './sidebars/jvm/java.ts',
showLastUpdateTime: false,
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
], [
// Spring 文档实例
'@docusaurus/plugin-content-docs',
{
id: 'spring',
path: 'docs/jvm/spring',
routeBasePath: 'jvm/spring',
sidebarPath: './sidebars/jvm/spring.ts',
showLastUpdateTime: false,
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
], [
// Kafka 文档实例
'@docusaurus/plugin-content-docs',
{
id: 'kafka',
path: 'docs/jvm/kafka',
routeBasePath: 'jvm/kafka',
sidebarPath: './sidebars/jvm/kafka.ts',
showLastUpdateTime: false,
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
], [
// Database 文档实例
'@docusaurus/plugin-content-docs',
{
id: 'database',
path: 'docs/database',
routeBasePath: 'database',
sidebarPath: './sidebars/database.ts',
showLastUpdateTime: false,
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
], [
// Git 文档实例
'@docusaurus/plugin-content-docs',
{
id: 'git',
path: 'docs/programmer/git',
routeBasePath: 'programmer/git',
sidebarPath: './sidebars/programmer/git.ts',
showLastUpdateTime: false,
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
], [
// Protocol 文档实例
'@docusaurus/plugin-content-docs',
{
id: 'protocol',
path: 'docs/programmer/protocol',
routeBasePath: 'programmer/protocol',
sidebarPath: './sidebars/programmer/protocol.ts',
showLastUpdateTime: false,
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
], [
// Rust 文档实例
'@docusaurus/plugin-content-docs',
{
id: 'rust',
path: 'docs/programmer/rust',
routeBasePath: 'programmer/rust',
sidebarPath: './sidebars/programmer/rust.ts',
showLastUpdateTime: false,
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
], [
// Dollar 文档实例
'@docusaurus/plugin-content-docs',
{
id: 'dollar',
path: 'docs/dollar',
routeBasePath: 'dollar',
sidebarPath: './sidebars/dollar.ts',
showLastUpdateTime: false,
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
],
],
themeConfig: {
// Replace with your project's social card
image: 'img/docusaurus-social-card.jpg',
colorMode: {
defaultMode: 'light', // 默认主题 light/dark
respectPrefersColorScheme: false, // 优先使用系统主题(会覆盖 defaultMode)
disableSwitch: false, // 是否禁用切换按钮
},
tableOfContents: {
minHeadingLevel: 2,
maxHeadingLevel: 6,
},
docs: {
sidebar: {
hideable: true, // 左侧栏可收起
autoCollapseCategories: false, // 自动折叠非当前分类
},
},
blog: {
sidebar: {
groupByYear: true, // 根据年分组
},
},
algolia: {
appId: 'S2Q2TJV9SH',
apiKey: 'fc9d428f8815ca5b5b860b70f05d31de',
indexName: 'ituknown_org', // algolia 爬虫名称
contextualSearch: false, // 这里不能改
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.oneDark,
additionalLanguages: [ // 代码语法高亮
'bash',
'c',
'cpp',
'dart',
'docker',
'go',
'git',
'java',
'powershell',
'rust',
'sql',
"vim",
'yaml',
'zig',
],
},
navbar: {
// title: 'NoteBook',
hideOnScroll: false, // 滚动时隐藏 Top 导航
logo: {
alt: 'Logo',
src: 'img/favicon.png',
},
items: [
{
type: 'docSidebar',
sidebarId: 'ffmpeg',
docsPluginId: 'ffmpeg',
position: 'left',
label: 'FFmpeg 命令行',
}, {
type: 'dropdown',
label: '🖥️操作系统',
position: 'left',
items: [
{
type: 'docSidebar',
sidebarId: 'linux',
docsPluginId: 'linux',
label: 'Linux',
}, {
type: 'docSidebar',
sidebarId: 'windows',
docsPluginId: 'windows',
label: 'Windows',
},
],
}, {
type: 'dropdown',
label: 'JVM 生态',
position: 'left',
items: [
{
type: 'docSidebar',
sidebarId: 'java',
docsPluginId: 'java',
label: 'Java 笔记',
}, {
type: 'docSidebar',
sidebarId: 'spring',
docsPluginId: 'spring',
label: 'Spring',
}, {
type: 'docSidebar',
sidebarId: 'kafka',
docsPluginId: 'kafka',
label: 'Kafka',
},
],
}, {
type: 'docSidebar',
sidebarId: 'database',
docsPluginId: 'database',
label: '📀数据库',
}, {
type: 'dropdown',
label: '🛠编程',
position: 'left',
items: [
{
type: 'docSidebar',
sidebarId: 'git',
docsPluginId: 'git',
label: '💫 Git',
}, {
type: 'docSidebar',
sidebarId: 'protocol',
docsPluginId: 'protocol',
label: '🌍 Protocol',
}, {
type: 'docSidebar',
sidebarId: 'rust',
docsPluginId: 'rust',
label: '🦀 Rust',
}
],
},
{
type: 'docSidebar',
sidebarId: 'dollar',
docsPluginId: 'dollar',
position: 'left',
label: '💰钱钱',
},
{
to: '/blog',
label: '📝博客',
position: 'left'
},
// 语言本地化
{
type: 'localeDropdown',
position: 'right',
},
// {
// href: 'https://github.com/ituknown',
// label: 'GitHub',
// position: 'right',
// },
],
},
} satisfies Preset.ThemeConfig,
};
export default config;