-
Notifications
You must be signed in to change notification settings - Fork 18
/
docusaurus.config.ts
325 lines (307 loc) · 10.3 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
314
315
316
317
318
319
320
321
322
323
324
325
import type { Config } from '@docusaurus/types'
import type { Options as PluginClientRedirectsOptions } from '@docusaurus/plugin-client-redirects'
import type { Options as BlogOptions } from '@docusaurus/plugin-content-blog'
import type { Options as PresetClassicOptions } from '@docusaurus/preset-classic'
import type { ThemeConfig as PresetClassicThemeConfig } from '@docusaurus/preset-classic'
import { themes } from 'prism-react-renderer'
const lightCodeTheme = themes.github
const darkCodeTheme = themes.dracula
import inspectUrls from '@jsdevtools/rehype-url-inspector'
import type { Options as RehypeURLInspectorOptions } from '@jsdevtools/rehype-url-inspector'
import type { PluginOptions as DocusaurusSearchLocalOptions } from '@easyops-cn/docusaurus-search-local'
import annotateOverseasLinks from './src/plugins/awly-rehype-annotate-overseas-links'
import type { PluginOptions as AWLYAsmDBPluginOptions } from './src/plugins/awly-asmdb-plugin'
import type { PluginOptions as AWLYDataPluginOptions } from './src/plugins/awly-data-plugin'
import awlyAsmDBPlugin from './src/plugins/awly-asmdb-plugin'
import awlyDataPlugin from './src/plugins/awly-data-plugin'
import awlyRemarkNatlangUsage from './src/plugins/awly-remark-natlang-usage'
const commonBeforeDefaultRemarkPlugins = [awlyRemarkNatlangUsage]
const commonRehypePlugins = [
[
inspectUrls,
{
inspectEach(m) {
annotateOverseasLinks(m)
},
selectors: ['a[href]'],
} satisfies RehypeURLInspectorOptions,
],
]
const config: Config = {
title: '咱龙了吗?',
tagline: '一站式了解 LoongArch 的上游生态建设。',
url: 'https://areweloongyet.com',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
// currently breaks TWiL 28's original pic links
// trailingSlash: true, // to reduce number of 301's with GitHub Pages
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'loongson-community', // Usually your GitHub org/user name.
projectName: 'areweloongyet', // Usually your repo name.
// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'zh-Hans',
locales: ['zh-Hans'],
},
future: {
experimental_faster: true,
},
markdown: {
mermaid: true,
},
plugins: [
[
awlyAsmDBPlugin,
{
genAsmdbDataPath: './scripts/asmdb/gen-asmdb-data',
loongarchOpcodesPath: './3rdparty/loongarch-opcodes',
} satisfies AWLYAsmDBPluginOptions,
],
[
awlyDataPlugin,
{
sourcePath: './src/data',
} satisfies AWLYDataPluginOptions,
],
[
'@docusaurus/plugin-client-redirects',
{
redirects: [
{
to: '/newsletter/this-week-in-loongarch-1',
from: '/blog/this-week-in-loongarch-1',
},
{
to: '/newsletter/this-week-in-loongarch-2',
from: '/blog/this-week-in-loongarch-2',
},
{
to: '/newsletter/this-week-in-loongarch-3',
from: '/blog/this-week-in-loongarch-3',
},
{
to: '/newsletter/this-week-in-loongarch-4',
from: '/blog/this-week-in-loongarch-4',
},
{
to: '/newsletter/this-week-in-loongarch-5',
from: '/blog/this-week-in-loongarch-5',
},
{
to: '/newsletter/these-weeks-in-loongarch-6',
from: '/blog/these-weeks-in-loongarch-6',
},
{
to: '/newsletter/this-week-in-loongarch-7',
from: '/blog/this-week-in-loongarch-7',
},
{
to: '/newsletter/this-week-in-loongarch-8',
from: '/blog/this-week-in-loongarch-8',
},
{
to: '/newsletter/this-week-in-loongarch-9',
from: '/blog/this-week-in-loongarch-9',
},
{
to: 'https://liblol.aosc.io/docs/dev/design/',
from: '/docs/world-compat-details/liblol',
},
// allow iterating over all TWiL articles with the singular title
// form, i.e. "this-week-..."
{
to: '/newsletter/these-weeks-in-loongarch-6',
from: '/newsletter/this-week-in-loongarch-6',
},
{
to: '/newsletter/these-weeks-in-loongarch-12',
from: '/newsletter/this-week-in-loongarch-12',
},
{
to: '/newsletter/these-weeks-in-loongarch-33',
from: '/newsletter/this-week-in-loongarch-33',
},
{
to: '/newsletter/these-weeks-in-loongarch-44',
from: '/newsletter/this-week-in-loongarch-44',
},
{
to: '/newsletter/these-weeks-in-loongarch-51',
from: '/newsletter/this-week-in-loongarch-51',
},
],
} satisfies PluginClientRedirectsOptions,
],
[
'@docusaurus/plugin-content-blog',
{
id: 'blog-newsletter',
routeBasePath: 'newsletter',
path: './newsletter',
blogTitle: '每周一龙',
blogDescription:
'龙架构新世界生态建设周报《每周一龙》(This Week in LoongArch)。每周一都为大家报道 LoongArch 社区最前线的第一手新鲜资讯!',
editUrl:
'https://github.com/loongson-community/areweloongyet/edit/main',
beforeDefaultRemarkPlugins: commonBeforeDefaultRemarkPlugins,
rehypePlugins: commonRehypePlugins,
onUntruncatedBlogPosts: 'throw',
} satisfies BlogOptions,
],
],
presets: [
[
'classic',
{
docs: {
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: 'https://github.com/loongson-community/areweloongyet',
beforeDefaultRemarkPlugins: commonBeforeDefaultRemarkPlugins,
rehypePlugins: commonRehypePlugins,
},
blog: {
blogTitle: '本站动态',
blogDescription: '《咱龙了吗?》网站本身的开发、运营动态。',
showReadingTime: true,
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: 'https://github.com/loongson-community/areweloongyet',
beforeDefaultRemarkPlugins: commonBeforeDefaultRemarkPlugins,
rehypePlugins: commonRehypePlugins,
onUntruncatedBlogPosts: 'throw',
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
} as PresetClassicOptions,
],
],
themes: [
[
'@easyops-cn/docusaurus-search-local',
{
hashed: 'filename',
language: ['en', 'zh'],
blogDir: ['blog', 'newsletter'],
blogRouteBasePath: ['/blog', '/newsletter'],
} satisfies DocusaurusSearchLocalOptions,
],
'@docusaurus/theme-mermaid',
],
themeConfig: {
colorMode: {
disableSwitch: false,
respectPrefersColorScheme: true,
},
navbar: {
title: '',
logo: {
alt: 'My Site Logo',
src: 'img/logo.svg',
},
items: [
{
type: 'doc',
docId: 'intro',
position: 'left',
label: '阅读材料',
},
{ to: '/newsletter', label: '每周一龙', position: 'left' },
{ to: '/asmdb', label: '汇编速查', position: 'left' },
{ to: '/blog', label: '本站动态', position: 'left' },
{
href: 'https://github.com/loongson-community/areweloongyet',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: '站内导航',
items: [
{
label: '阅读材料',
to: '/docs/intro',
},
{
label: '每周一龙',
to: '/newsletter',
},
{
label: '汇编速查',
to: '/asmdb',
},
{
label: '本站动态',
to: '/blog',
},
],
},
{
title: '社区资源',
items: [
{
label: '龙芯社区 GitHub',
href: 'https://github.com/loongson-community',
},
{
label: 'LoongArch 非官方论坛',
href: 'https://bbs.loongarch.org',
},
{
label: 'Telegram Loongson Group',
href: 'https://t.me/loongson_users',
},
{
label: '龙芯用户闲聊 Matrix 群',
href: 'https://matrix.to/#/%23loongson-users-ot:matrix.org',
},
{
label: '百度贴吧龙芯吧',
href: 'https://tieba.baidu.com/f?kw=%E9%BE%99%E8%8A%AF&ie=utf-8',
},
],
},
{
title: '企业资源',
items: [
{
label: '龙芯公司官网',
href: 'https://loongson.cn',
},
{
label: '龙芯公司官方 GitHub',
href: 'https://github.com/loongson',
},
],
},
],
copyright: `© 2022-${new Date().getFullYear()} 本项目的贡献者们。本项目与任何营利性实体均利益无关。<br />本站内容中提及的商标均为相应拥有者的财产。`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
// ideally there would be an assembly highlighter (TWiL 28 has some x86
// asm in GAS AT&T syntax), but currently there isn't one
//
// see https://github.com/PrismJS/prism/issues/482
//
// this is now resolved for the LoongArch asm with custom plugin housed
// right in the repo, and swizzled prism-include-languages component,
// as per Docusaurus docs, so the "loongasm" language is not being
// represented here
additionalLanguages: ['bash', 'shell-session'],
},
} satisfies PresetClassicThemeConfig,
}
export default config