-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathdocusaurus.config.ts
313 lines (309 loc) · 9.39 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
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
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
// Import Types
import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import type {Options as DocsOptions} from '@docusaurus/plugin-content-docs';
import type {Options as PageOptions} from '@docusaurus/plugin-content-pages';
// Import the Docusaurus version.
import { DOCUSAURUS_VERSION } from '@docusaurus/utils'
// Setup our Prism themes.
import { themes } from 'prism-react-renderer';
const lightCodeTheme = themes.vsLight;
const darkCodeTheme = themes.vsDark;
// Define our admonitions config.
const admonitionsConfig = {
admonitions: {
keywords: [
'discord',
'info',
'success',
'danger',
'note',
'tip',
'warning',
'important',
'caution',
'powershell',
'security',
'ninja',
'release',
'credit',
'docusaurus'
],
},
}
// Import our remark plugins.
import npm2yarn from '@docusaurus/remark-plugin-npm2yarn';
import tabBlocks from 'docusaurus-remark-plugin-tab-blocks';
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';
import remarkDefList from 'remark-deflist';
// Setup our common remark plugin config.
const remarkPluginsConfig = {
remarkPlugins: [
[ npm2yarn, { sync: true } ],
tabBlocks,
remarkMath,
rehypeKatex,
remarkDefList,
]
}
// Setup our common config options for docs plugin instances.
const commonDocsPluginConfig = {
showLastUpdateAuthor: false,
showLastUpdateTime: true,
sidebarCollapsible: true,
sidebarCollapsed: true,
...admonitionsConfig,
...remarkPluginsConfig,
}
import plausiblePlugin from 'docusaurus-plugin-plausible';
/** @type {import('@docusaurus/types').Config} */
const config: Config = {
title: 'Docusaurus.community',
tagline: 'Docusaurus community knowledge sharing and plugin directory.',
favicon: 'img/favicon.ico',
url: 'https://docusaurus.community',
baseUrl: '/',
organizationName: 'homotechsual', // Usually your GitHub org/user name.
projectName: 'docusaurus.community', // Usually your repo name.
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
{
docs: {
routeBasePath: 'knowledge',
sidebarPath: './sidebars.js',
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: 'https://github.com/DocusaurusCommunity/website/edit/main/',
...commonDocsPluginConfig,
} satisfies DocsOptions,
blog: false,
pages: {
...admonitionsConfig,
...remarkPluginsConfig
} satisfies PageOptions,
theme: {
customCss: './src/scss/custom.scss',
},
} satisfies Preset.Options,
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
{
// Replace with your project's social card
image: 'img/docusaurus-social-card.jpg',
colorMode: {
defaultMode: 'dark',
disableSwitch: false,
respectPrefersColorScheme: true,
},
navbar: {
title: 'Docusaurus.community',
logo: {
alt: 'Docusaurus.community Logo',
src: 'img/logo.svg',
},
hideOnScroll: true,
items: [
{
type: 'doc',
docId: 'index',
position: 'left',
label: 'Knowledge',
docsPluginId: 'default',
},
{
type: 'doc',
docId: 'index',
position: 'left',
label: 'Contributing',
docsPluginId: 'contributing',
},
{
to: 'plugindirectory',
position: 'left',
label: 'Plugin Directory',
},
{
to: 'https://github.com/sponsors/homotechsual/',
label: 'Sponsor',
position: 'right',
target: '_blank',
className: 'sponsorship-link',
},
{
to: 'https://docusaurus.io',
label: 'Docusaurus',
position: 'right',
target: '_blank',
className: 'docusaurus-link',
},
{
to: 'https://discord.gg/docusaurus',
label: 'Discord',
position: 'right',
target: '_blank',
className: 'discord-link',
},
{
to: 'https://github.com/DocusaurusCommunity/website',
label: 'GitHub',
position: 'right',
target: '_blank',
className: 'github-link',
},
],
},
footer: {
logo: {
alt: 'Docusaurus Logo',
src: 'img/Docusaurus.svg',
href: 'https://docusaurus.io',
height: 50,
width: 50,
},
style: 'dark',
links: [
{
title: 'Guides',
items: [
{
label: 'Knowledge',
to: '/knowledge/',
},
],
},
{
title: 'Community',
items: [
{
label: 'Stack Overflow',
to: 'https://stackoverflow.com/questions/tagged/docusaurus',
},
{
label: 'Discord',
to: 'https://discordapp.com/invite/docusaurus',
},
{
label: 'Twitter',
to: 'https://twitter.com/docusaurus',
},
],
},
{
title: 'More',
items: [
{
label: 'Docusaurus Blog',
to: 'https://docusaurus.io/blog',
},
{
label: 'Docusaurus GitHub',
to: 'https://github.com/facebook/docusaurus',
},
{
label: 'Community GitHub',
to: 'https://github.com/DocusaurusCommunity',
},
],
},
],
copyright: `<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/80x15.png" /></a><br />Licensed by the Docusaurus community under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.<br />Built with <a href="https://docusaurus.io">Docusaurus v${DOCUSAURUS_VERSION}</a>.<br /><span class="designedBy">Designed with <svg xmlns="http://www.w3.org/2000/svg" class="heart" width="24" height="24" viewBox="0 0 24 24"><path d="M14 20.408c-.492.308-.903.546-1.192.709-.153.086-.308.17-.463.252h-.002a.75.75 0 01-.686 0 16.709 16.709 0 01-.465-.252 31.147 31.147 0 01-4.803-3.34C3.8 15.572 1 12.331 1 8.513 1 5.052 3.829 2.5 6.736 2.5 9.03 2.5 10.881 3.726 12 5.605 13.12 3.726 14.97 2.5 17.264 2.5 20.17 2.5 23 5.052 23 8.514c0 3.818-2.801 7.06-5.389 9.262A31.146 31.146 0 0114 20.408z"/></svg>
by <a href="https://homotechsual.dev">homotechsual</a></span>.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ['powershell','bash','docker', 'diff', 'json', 'sass']
},
} satisfies Preset.ThemeConfig,
plugins: [
[
'@docusaurus/plugin-ideal-image',
/** @type {import('@docusaurus/plugin-ideal-image').Options} */
{
quality: 100,
max: 1030, // max resized image's size.
min: 640, // min resized image's size. if original is lower, use that size.
steps: 2, // the max number of images generated between min and max (inclusive)
},
],
'docusaurus-plugin-sass',
[
plausiblePlugin,
{
domain: 'docusaurus.community',
},
],
[
'@docusaurus/plugin-content-docs',
/** @type {import('@docusaurus/plugin-content-docs').Options} */
{
id: 'contributing',
path: 'contributing',
routeBasePath: 'contributing',
sidebarPath: './sidebars.js',
editUrl: 'https://github.com/homotechsual/docusaurus.community/tree/main/',
...commonDocsPluginConfig,
} satisfies DocsOptions,
]
],
themes: [
[
require.resolve("@easyops-cn/docusaurus-search-local"),
/** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */
({
indexDocs: true,
indexBlog: false,
indexPages: true,
docsRouteBasePath: ["knowledge", "contributing"],
hashed: true,
docsDir: ["docs", "contributing"],
highlightSearchTermsOnTargetPage: true,
}),
],
],
webpack: {
jsLoader: (isServer: boolean) => ({
loader: 'swc-loader',
options: {
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
transform: {
react: {
runtime: 'automatic',
}
},
target: 'es2017',
},
module: {
type: isServer ? 'commonjs' : 'es6',
},
},
}),
},
markdown: {
format: 'detect',
mermaid: true,
mdx1Compat: {
comments: false,
headingIds: false,
admonitions: false,
}
},
};
export default config;