Skip to content

Commit 02a4698

Browse files
committedNov 28, 2023
update at 2023-11-28 16:51:44
1 parent 5a39286 commit 02a4698

File tree

5 files changed

+2386
-1253
lines changed

5 files changed

+2386
-1253
lines changed
 

‎content/sidebars.js ‎content/sidebars.ts

+3-17
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
1-
/**
2-
* Creating a sidebar enables you to:
3-
- create an ordered group of docs
4-
- render a sidebar for each doc of that group
5-
- provide next/previous navigation
6-
7-
The sidebars can be generated from the filesystem, or explicitly defined here.
8-
9-
Create as many sidebars as you want.
10-
*/
11-
12-
// @ts-check
13-
14-
// ref: https://docusaurus.io/docs/sidebar/items
15-
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
16-
const sidebars = {
1+
import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
2+
const sidebars: SidebarsConfig = {
173
istioSidebar: [
184
{
195
type: "doc",
@@ -176,4 +162,4 @@ const sidebars = {
176162
],
177163
};
178164

179-
module.exports = sidebars;
165+
export default sidebars;

‎docusaurus.config.js ‎docusaurus.config.ts

+8-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
// @ts-check
2-
// `@type` JSDoc annotations allow editor autocompletion and type checking
3-
// (when paired with `@ts-check`).
4-
// There are various equivalent ways to declare your Docusaurus config.
5-
// See: https://docusaurus.io/docs/api/docusaurus-config
6-
1+
import PrismDark from './src/utils/prismDark';
2+
import type { Config } from '@docusaurus/types';
73
const beian = '蜀ICP备2021009081号-1'
84

9-
/** @type {import('@docusaurus/types').Config} */
10-
const config = {
5+
const config: Config = {
116
title: 'istio 实践指南', // 网站标题
127
tagline: '云原生老司机带你飞', // slogan
138
favicon: 'img/logo.svg', // 电子书 favicon 文件,注意替换
@@ -64,7 +59,7 @@ const config = {
6459
// 文档的路由前缀
6560
routeBasePath: '/',
6661
// 左侧导航栏的配置
67-
sidebarPath: require.resolve('./content/sidebars.js'),
62+
sidebarPath: require.resolve('./content/sidebars.ts'),
6863
// 每个文档左下角 "编辑此页" 的链接
6964
editUrl: ({ docPath }) =>
7065
`https://github.com/imroc/istio-guide/edit/main/content/${docPath}`,
@@ -148,7 +143,7 @@ const config = {
148143
},
149144
// 自定义代码高亮
150145
prism: {
151-
theme: require('prism-react-renderer/themes/vsDark'),
146+
theme: PrismDark,
152147
magicComments: [
153148
{
154149
className: 'code-block-highlighted-line',
@@ -177,9 +172,11 @@ const config = {
177172
'java',
178173
'json',
179174
'hcl',
175+
'bash',
176+
'diff',
180177
],
181178
},
182179
}),
183180
};
184181

185-
module.exports = config;
182+
export default config;

‎package-lock.json

+2,290-1,215
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@
1515
"typecheck": "tsc"
1616
},
1717
"dependencies": {
18-
"@docusaurus/core": "3.0.0-beta.0",
19-
"@docusaurus/plugin-ideal-image": "^3.0.0-beta.0",
20-
"@docusaurus/plugin-pwa": "^3.0.0-beta.0",
21-
"@docusaurus/preset-classic": "3.0.0-beta.0",
18+
"@docusaurus/core": "3.0.0",
19+
"@docusaurus/plugin-ideal-image": "^3.0.0",
20+
"@docusaurus/plugin-pwa": "^3.0.0",
21+
"@docusaurus/preset-classic": "^3.0.0",
2222
"@giscus/react": "^2.3.0",
23-
"@mdx-js/react": "^2.3.0",
23+
"@mdx-js/react": "^3.0.0",
2424
"clsx": "^1.2.1",
2525
"docusaurus-plugin-sass": "^0.2.5",
2626
"path-browserify": "^1.0.1",
2727
"plugin-image-zoom": "github:flexanalytics/plugin-image-zoom",
28-
"prism-react-renderer": "^1.3.5",
28+
"prism-react-renderer": "^2.1.0",
2929
"raw-loader": "^4.0.2",
3030
"react": "^18.0.0",
3131
"react-dom": "^18.0.0",
32-
"sass": "^1.69.3"
32+
"sass": "^1.69.5"
3333
},
3434
"devDependencies": {
35-
"@docusaurus/module-type-aliases": "3.0.0-beta.0",
36-
"@docusaurus/tsconfig": "3.0.0-beta.0",
35+
"@docusaurus/module-type-aliases": "^3.0.0",
36+
"@docusaurus/tsconfig": "^3.0.0",
3737
"typescript": "~5.2.2"
3838
},
3939
"browserslist": {
@@ -49,6 +49,6 @@
4949
]
5050
},
5151
"engines": {
52-
"node": ">=16.14"
52+
"node": ">=18.0"
5353
}
5454
}

‎src/utils/prismDark.ts

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import { themes, type PrismTheme } from 'prism-react-renderer';
2+
3+
const baseTheme = themes.vsDark;
4+
5+
export default {
6+
plain: {
7+
color: '#D4D4D4',
8+
backgroundColor: '#212121',
9+
},
10+
styles: [
11+
...baseTheme.styles,
12+
{
13+
types: ['title'],
14+
style: {
15+
color: '#569CD6',
16+
fontWeight: 'bold',
17+
},
18+
},
19+
{
20+
types: ['property', 'parameter'],
21+
style: {
22+
color: '#9CDCFE',
23+
},
24+
},
25+
{
26+
types: ['script'],
27+
style: {
28+
color: '#D4D4D4',
29+
},
30+
},
31+
{
32+
types: ['boolean', 'arrow', 'atrule', 'tag'],
33+
style: {
34+
color: '#569CD6',
35+
},
36+
},
37+
{
38+
types: ['number', 'color', 'unit'],
39+
style: {
40+
color: '#B5CEA8',
41+
},
42+
},
43+
{
44+
types: ['font-matter'],
45+
style: {
46+
color: '#CE9178',
47+
},
48+
},
49+
{
50+
types: ['keyword', 'rule'],
51+
style: {
52+
color: '#C586C0',
53+
},
54+
},
55+
{
56+
types: ['regex'],
57+
style: {
58+
color: '#D16969',
59+
},
60+
},
61+
{
62+
types: ['maybe-class-name'],
63+
style: {
64+
color: '#4EC9B0',
65+
},
66+
},
67+
{
68+
types: ['constant'],
69+
style: {
70+
color: '#4FC1FF',
71+
},
72+
},
73+
],
74+
} satisfies PrismTheme;
75+

0 commit comments

Comments
 (0)
Please sign in to comment.