-
Notifications
You must be signed in to change notification settings - Fork 2
/
docusaurus.config.ts
161 lines (147 loc) · 5.13 KB
/
docusaurus.config.ts
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
import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import { mdxOptions, remarkRehypeOptions } from './docusaurus/mdx';
import navbars from './docusaurus/navbars';
import footers from './docusaurus/footers';
import i18n from './docusaurus/i18n';
import plugins from './docusaurus/plugins';
import prism from './docusaurus/prism';
import { translateConfig, BASE_URL, HOME_URL, DEV } from './docusaurus/utils';
const config: Config = {
title: translateConfig({
'zh-hans': 'CloudPSS 知识库',
}),
tagline: translateConfig({
'zh-hans': '构建开源、开放、协作、共享的 CloudPSS 生态',
}),
favicon: 'icons/favicon.ico',
// Set the production url of your site here
url: 'https://kb.cloudpss.net',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: BASE_URL,
trailingSlash: true,
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'CloudPSS', // Usually your GitHub org/user name.
projectName: 'docs', // Usually your repo name.
onBrokenLinks: DEV ? 'warn' : 'throw',
onBrokenAnchors: DEV ? 'warn' : 'throw',
onBrokenMarkdownLinks: DEV ? 'warn' : 'throw',
onDuplicateRoutes: DEV ? 'warn' : 'throw',
customFields: {
HOME_URL,
},
i18n,
markdown: {
mermaid: true,
remarkRehypeOptions: {
...remarkRehypeOptions,
clobberPrefix: '',
footnoteLabelProperties: { className: ['visually-hidden'] },
footnoteBackContent(referenceIndex, rereferenceIndex) {
const main = { type: 'text', value: '\u21A9\uFE0E' } as const;
if (rereferenceIndex <= 1) {
return [main];
}
return [
main,
{
type: 'element',
tagName: 'sup',
properties: {},
children: [{ type: 'text', value: String(rereferenceIndex) }],
},
];
},
...translateConfig({
'zh-hans': {
footnoteLabel: '脚注',
footnoteBackLabel(referenceIndex, rereferenceIndex) {
return `返回引文位置 ${referenceIndex + 1}${rereferenceIndex > 1 ? '-' + rereferenceIndex : ''}`;
},
},
}),
},
},
clientModules: ['./src/js/index.ts'],
themes: ['@docusaurus/theme-mermaid'],
plugins,
presets: [
[
'classic',
{
docs: {
routeBasePath: '/',
sidebarPath: './docusaurus/sidebars.ts',
showLastUpdateTime: true,
showLastUpdateAuthor: true,
onInlineTags: DEV ? 'warn' : 'throw',
editUrl: 'https://github.com/CloudPSS/docs/blob/main/',
...mdxOptions,
},
blog: {
routeBasePath: '/blog',
showReadingTime: true,
onInlineTags: DEV ? 'warn' : 'throw',
onInlineAuthors: DEV ? 'warn' : 'throw',
onUntruncatedBlogPosts: DEV ? 'warn' : 'throw',
editUrl: 'https://github.com/CloudPSS/docs/blob/main/',
blogTitle: '博客',
blogDescription: 'CloudPSS 博客',
blogSidebarTitle: '最近文章',
...mdxOptions,
},
pages: {
...mdxOptions,
},
theme: {
customCss: './src/css/index.css',
},
} satisfies Preset.Options,
],
],
themeConfig: {
// Replace with your project's social card
// image: 'img/docusaurus-social-card.jpg',
docs: {
sidebar: {
hideable: true,
autoCollapseCategories: true,
},
},
colorMode: {
defaultMode: 'light',
respectPrefersColorScheme: true,
},
navbar: {
title: 'CloudPSS',
hideOnScroll: false,
logo: {
alt: 'CloudPSS',
src: 'icons/favicon.svg',
style: {
width: '2em',
margin: '0 0.5em',
},
},
items: navbars,
},
footer: {
style: 'dark',
...footers,
},
prism,
zoom: {
selector: '.markdown figure > img, .markdown .docusaurus-mermaid-container > svg',
background: {
light: 'var(--background)',
dark: 'var(--background)',
},
config: {
container: '.medium-zoom-container',
},
},
} satisfies Preset.ThemeConfig,
};
export default config;