-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvuepress.config.ts
More file actions
143 lines (135 loc) · 3.86 KB
/
Copy pathvuepress.config.ts
File metadata and controls
143 lines (135 loc) · 3.86 KB
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
import { OPEN_SOURCE_ADDRESS, OPEN_SOURCE_AUTHOR } from '@142vip/open-source'
import { GitGeneralBranch, vipDocSite, VipPackageJSON } from '@142vip/utils'
import {
defineVipVuepressConfig,
getVipHopeTheme,
handleImportCodePath,
VUEPRESS_DEFAULT_DOCS_DIR,
} from '@142vip/vuepress'
import { navbarConfig, sidebarConfig } from './docs/theme.config'
const pkg = VipPackageJSON.getPackageJSON<{ description: string }>()
/**
* 页脚
*/
const footerHtmlStr = `
<div>
All Rights Reserved
<a href="${OPEN_SOURCE_ADDRESS.HOME_PAGE_GITHUB_VIP}" target="_blank">@${OPEN_SOURCE_ADDRESS.GITHUB_ORGANIZATION_NAME}</a> |
<strong>${pkg.name}@v${pkg.version} </strong>
</div>
<div style="margin-top: 5px">
<a href="${OPEN_SOURCE_ADDRESS.BAIDU_STATISTICS_URL}" target="_blank">${OPEN_SOURCE_ADDRESS.BAIDU_STATISTICS_NAME}</a>
<span style="margin: 0 5px;">|</span>
<a href="${OPEN_SOURCE_ADDRESS.BEI_AN_URL}" target="_blank">${OPEN_SOURCE_ADDRESS.BEI_AN_NAME}</a>
</div>
`
/**
* 版权信息
*/
const copyrightHtmlStr = `
<strong>MIT 协议</strong> | 版权所有 © 2015-${new Date().getFullYear()} ${OPEN_SOURCE_AUTHOR.name}
<div style="margin-top: 10px">
<a
href="${OPEN_SOURCE_ADDRESS.SITE_DEPLOY_JavaScriptCollection_GITHUB}"
target="_blank"
style="padding: 5px"
>
<img
alt="408CSFamily Deploy In Github Pages"
src="https://img.shields.io/badge/github-success-green?logo=github&color=bef9c6"
>
</a>
<a
href="${OPEN_SOURCE_ADDRESS.SITE_DEPLOY_JavaScriptCollection_NETLIFY}"
target="_blank"
style="padding: 5px"
>
<img
alt="408CSFamily Deploy In Netlify"
src="https://img.shields.io/badge/netlify-success-green?logo=netlify&color=bef9c6"
>
</a>
<a
href="${OPEN_SOURCE_ADDRESS.SITE_DEPLOY_JavaScriptCollection_VERCEL}"
target="_blank"
style="padding: 5px"
>
<img
src="https://img.shields.io/badge/vercel-success-green?logo=vercel&color=bef9c6"
alt="408CSFamily Deploy In Vercel"
>
</a>
</div>
`
/**
* 站点配置
*/
export default defineVipVuepressConfig({
base: vipDocSite.getBase(pkg.name),
title: '凡是过往、皆为序章',
description: pkg.description,
port: 5000,
head: [
['link', { rel: 'icon', href: 'favicon.ico' }],
// vercel统计 相关配置
['script', { type: 'text/javascript', src: '/_vercel/insights/script.js' }],
// 百度统计
[
'script',
{},
`var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?613c9d7af9e1c9a7f9eef6a55aa2399d";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();`,
],
],
source: '',
markdown: {
importCode: {
handleImportPath: handleImportCodePath([
['@code', 'code'],
['@algorithm', 'code/algorithm'],
['~', ''],
]),
},
headers: {
level: [2, 3, 4],
},
},
// 主题配置
theme: getVipHopeTheme({
// 导航栏
navbar: navbarConfig,
// 侧边栏
sidebar: sidebarConfig,
// 页脚
footer: footerHtmlStr,
// logo: '/logo.png',
// logoDark: '/logo.png',
// 版权
copyright: copyrightHtmlStr,
// 仓库 142vip/JavaScriptCollection
repo: `${OPEN_SOURCE_ADDRESS.GITHUB_ORGANIZATION_NAME}/${pkg.name}`,
// 作者信息
author: OPEN_SOURCE_AUTHOR,
// 文档路径,开启编辑功能
docsDir: VUEPRESS_DEFAULT_DOCS_DIR,
docsBranch: GitGeneralBranch.NEXT,
// 主题布局选项
docsRepo: OPEN_SOURCE_ADDRESS.GITHUB_REPO_JSC,
contributors: true,
// 插件
plugins: {
// 水印
watermark: {
enabled: false,
watermarkOptions: {
content: OPEN_SOURCE_AUTHOR.name,
},
},
},
}),
})