Skip to content

Commit 48413b4

Browse files
committed
update config file
1 parent e1a932f commit 48413b4

File tree

4 files changed

+42
-22
lines changed

4 files changed

+42
-22
lines changed

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
2+
presets: ['@docusaurus/core/lib/babel/preset']
33
};

docusaurus.config.js renamed to docusaurus.config.ts

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
// @ts-check
1+
import type { Config } from '@docusaurus/types';
2+
import type * as Preset from '@docusaurus/preset-classic';
3+
import { themes as PrismThemes } from 'prism-react-renderer';
4+
import remarkMath from 'remark-math';
5+
import rehypeKatex from 'rehype-katex';
26

3-
const config = {
7+
export default {
48
title: '洛谷开放平台文档',
59
favicon: 'img/favicon.ico',
610

@@ -12,24 +16,45 @@ const config = {
1216

1317
i18n: {
1418
defaultLocale: 'zh-Hans',
15-
locales: ['zh-Hans'],
19+
locales: ['zh-Hans']
20+
},
21+
22+
markdown: {
23+
mdx1Compat: {
24+
comments: false,
25+
admonitions: false,
26+
headingIds: true /* until they provide a new syntax */
27+
}
1628
},
1729

1830
presets: [
1931
['@docusaurus/preset-classic', {
2032
blog: false,
2133
pages: false,
2234
docs: {
23-
routeBasePath: '/'
35+
sidebarPath: './sidebars.ts',
36+
routeBasePath: '/',
37+
remarkPlugins: [remarkMath],
38+
rehypePlugins: [rehypeKatex]
39+
},
40+
theme: {
41+
customCss: './src/style.css'
2442
}
25-
}],
26-
['redocusaurus', {
43+
} satisfies Preset.Options],
44+
/*['redocusaurus', {
2745
specs: [
2846
{ id: 'open', spec: './openapi/_api.yaml', route: '/openapi' }
2947
]
30-
}]
48+
} satisfies Preset.Options]*/ // TODO: replacement
3149
],
3250

51+
stylesheets: [{
52+
href: 'https://cdn.luogu.com.cn/assets/katex:0.16.7/katex.min.css',
53+
type: 'text/css',
54+
integrity: 'sha384-3UiQGuEI4TTMaFmGIZumfRPtfKQ3trwQE2JgosJxCnGmQpL/lJdjpcHkaaFwHlcI',
55+
crossorigin: 'anonymous',
56+
}],
57+
3358
themeConfig: {
3459
navbar: {
3560
title: '洛谷开放平台',
@@ -62,10 +87,8 @@ const config = {
6287
`
6388
},
6489
prism: {
65-
theme: require('prism-react-renderer/themes/github'),
66-
darkTheme: require('prism-react-renderer/themes/dracula')
90+
theme: PrismThemes.github,
91+
darkTheme: PrismThemes.dracula
6792
}
68-
},
69-
};
70-
71-
module.exports = config;
93+
} satisfies Preset.ThemeConfig
94+
} satisfies Config;

sidebars.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

sidebars.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
2+
3+
export default {
4+
sidebar: [{ type: 'autogenerated', dirName: '.' }]
5+
} satisfies SidebarsConfig;

0 commit comments

Comments
 (0)