-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathvuepress.config.ts
104 lines (100 loc) · 2.68 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
import { fileURLToPath } from 'node:url'
import { defineUserConfig } from '@vuepress/cli'
import { path } from '@vuepress/utils'
import viteBundler from '@vuepress/bundler-vite'
import {
OPEN_SOURCE_ADDRESS,
OPEN_SOURCE_AUTHOR,
getDocSiteBase,
} from '@142vip/utils'
import {
FamilyHeaders,
getCopyRightText,
getFooterHtml,
getThemeConfig,
getViteBundler,
} from '@142vip/vuepress'
import { hopeTheme } from 'vuepress-theme-hope'
import pkg from './package.json'
import { navbarConfig, sidebarConfig } from './docs/theme.config'
/**
* 用户自定义配置
* 注意:
* - 环境变量中的PROXY_DOMAIN字段,用于区分是否nginx代理
*/
export default defineUserConfig({
base: getDocSiteBase(pkg.name),
title: '计算机408全家桶',
description: '磨刀不误砍柴工,读完硕士再打工',
port: 4200,
source: '',
head: FamilyHeaders,
markdown: {
// todo 引入代码文件时的路径替换
importCode: {
handleImportPath: (str) => {
const __dirname = path.dirname(fileURLToPath(import.meta.url))
if (str.includes('@code')) {
return str.replace(/^@code/, path.resolve(__dirname, '../../code/'))
}
if (str.includes('@ds')) {
return str.replace(/^@ds/, path.resolve(__dirname, '../../code/ds/'))
}
if (str.includes('~')) {
return str.replace(/^~/, path.resolve(__dirname, '../../'))
}
return str
},
},
headers: {
level: [2, 3, 4],
},
},
// 主题配置
theme: hopeTheme({
...getThemeConfig({
// 导航栏
navbar: navbarConfig,
// 侧边栏
sidebar: sidebarConfig,
navbarLayout: {
start: ['Brand'],
center: ['Links'],
end: ['Language', 'Outlook', 'Repo', 'Search'],
},
favicon: '/408_favicon.ico',
logo: '/408_logo.png',
logoDark: '/408_logo.png',
hostname: 'https://408.142vip.cn',
// 页脚
footer: getFooterHtml({
name: pkg.name,
version: pkg.version,
}),
// 版权
copyright: getCopyRightText(OPEN_SOURCE_AUTHOR.name),
// 仓库
repo: '142vip/408CSFamily',
repoLabel: 'GitHub',
// 作者信息
author: OPEN_SOURCE_AUTHOR,
// 文档路径,开启编辑功能
docsDir: 'docs',
docsBranch: 'next',
// 主题布局选项
docsRepo: OPEN_SOURCE_ADDRESS.GITHUB_REPO_408,
// 插件
plugins: {
// 水印
watermark: {
enabled: false,
watermarkOptions: {
content: OPEN_SOURCE_AUTHOR.name,
},
},
},
}),
}),
bundler: viteBundler(getViteBundler()),
shouldPrefetch: false,
})