-
Notifications
You must be signed in to change notification settings - Fork 7
/
vuepress.config.ts
157 lines (153 loc) · 4.51 KB
/
vuepress.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
import { defaultTheme, viteBundler, type UserConfig } from "vuepress";
import { docsearchPlugin } from "@vuepress/plugin-docsearch";
import { containerPlugin } from "@vuepress/plugin-container";
import { mdEnhancePlugin } from "vuepress-plugin-md-enhance";
import { copyCodePlugin } from "vuepress-plugin-copy-code2";
import { sitemapPlugin } from "vuepress-plugin-sitemap2";
import multimdTable from "markdown-it-multimd-table";
import { ioBlockPlugin } from "./plugins/io-block";
import { codemoPlugin } from "./plugins/codemo";
import { sdscPlugin } from "./plugins/sdsc";
import { path } from "@vuepress/utils";
import { Sidebar } from "./plugins/sidebar";
import { autolinkerPlugin } from "./plugins/autolinker";
const sidebar = new Sidebar({
sourceDir: path.resolve(__dirname, "src"),
});
const config: UserConfig = {
lang: "zh-CN",
title: "谷雨同学的 C++ 教程",
description: "Learn C++ in a modern way",
dest: "./dist",
theme: defaultTheme({
sidebar: sidebar.forVueDefaultTheme(),
navbar: ["/technical_info"],
sidebarDepth: 0,
contributors: false,
lastUpdatedText: "最近更新",
themePlugins: {
container: {
// 使用自定义版本
tip: false,
warning: false,
danger: false,
},
backToTop: false, // 会挡住 codemo
},
}),
alias: {
"@src": path.resolve(__dirname, "src"),
"@plugins": path.resolve(__dirname, "plugins"),
},
bundler: viteBundler({
viteOptions: {
ssr: {
// @gytx/gcc-translation is an ESM only package.
// Vite doesn't support externalize it, see
// https://vitejs.dev/guide/ssr.html#ssr-externals
noExternal: ["@gytx/gcc-translation", "splitpanes"],
},
},
}),
plugins: [
containerPlugin({
type: "tip",
locales: {
"/": {
defaultInfo: "提示",
},
},
}),
containerPlugin({
type: "warning",
locales: {
"/": {
defaultInfo: "注意",
},
},
}),
containerPlugin({
type: "danger",
locales: {
"/": {
defaultInfo: "危险",
},
},
}),
// autolinker 会使用 JSDOM,它不识别 Vue 组件。
// 所以不能把它放在会产生 Vue 组件的 codemo 后面
autolinkerPlugin(),
codemoPlugin(),
mdEnhancePlugin({
flowchart: true,
tasklist: true,
katex: true,
}),
docsearchPlugin({
appId: "LX33TRMJGI",
apiKey: "2bd18aae3d30f5c2ea161ee554dba6c7",
indexName: "cpp-tutorial",
placeholder: "搜索文档",
translations: {
button: {
buttonText: "搜索",
buttonAriaLabel: "搜索",
},
modal: {
searchBox: {
resetButtonTitle: "清除",
resetButtonAriaLabel: "清除",
cancelButtonText: "取消",
cancelButtonAriaLabel: "取消",
},
startScreen: {
recentSearchesTitle: "最近搜索",
noRecentSearchesText: "没有最近搜索",
saveRecentSearchButtonTitle: "保存此搜索",
removeRecentSearchButtonTitle: "从历史中移除此搜索",
favoriteSearchesTitle: "收藏",
removeFavoriteSearchButtonTitle: "从收藏中移除此搜索",
},
errorScreen: {
titleText: "无法获取结果",
helpText: "你可能需要检查你的网络连接情况",
},
footer: {
selectText: "选择",
selectKeyAriaLabel: "回车键",
navigateText: "导航",
navigateUpKeyAriaLabel: "方向上键",
navigateDownKeyAriaLabel: "方向下键",
closeText: "关闭",
closeKeyAriaLabel: "Esc 键",
searchByText: "技术支持",
},
noResultsScreen: {
noResultsText: "找不到",
suggestedQueryText: "尝试搜索",
reportMissingResultsLinkText: "如果你认为此搜索应当返回结果,请",
reportMissingResultsText: "告诉我们。"
}
}
},
}),
sitemapPlugin({
hostname: "https://cpp-tutorial.vercel.app",
}),
copyCodePlugin({
selector: [
'.theme-default-content div[class*="language-c"] pre:not(.dirty)',
'.hidden-copycode-codeblock'
]
}),
ioBlockPlugin(),
sdscPlugin(),
sidebar.forPlugin(),
],
extendsMarkdown: (mdi) => {
mdi.use(multimdTable, {
rowspan: true
});
}
};
export default config;