-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
89 lines (84 loc) · 1.91 KB
/
index.js
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
const path = require('path')
const r = (...args) => path.resolve(__dirname, ...args)
// Theme API.
module.exports = (options, ctx) => {
const { themeConfig, siteConfig } = ctx
// resolve algolia
const isAlgoliaSearch =
themeConfig.algolia ||
Object.keys((siteConfig.locales && themeConfig.locales) || {}).some(
base => themeConfig.locales[base].algolia
)
const enableSmoothScroll = themeConfig.smoothScroll === true
return {
alias() {
return {
'@AlgoliaSearchBox': isAlgoliaSearch
? r('components/AlgoliaSearchBox.vue')
: r('noopModule.js')
}
},
plugins: [
['@vuepress/active-header-links', options.activeHeaderLinks],
'@vuepress/search',
'@vuepress/nprogress',
'@vuepress/pwa',
'@vuepress/back-to-top',
[
'container',
{
type: 'tip',
defaultTitle: {
'/': 'TIP',
'/zh/': '提示'
}
}
],
[
'container',
{
type: 'warning',
defaultTitle: {
'/': 'WARNING',
'/zh/': '注意'
}
}
],
[
'container',
{
type: 'danger',
defaultTitle: {
'/': 'WARNING',
'/zh/': '警告'
}
}
],
[
'container',
{
type: 'details',
before: info =>
`<details class="custom-block details">${info ? `<summary>${info}</summary>` : ''}\n`,
after: () => '</details>\n'
}
],
[
'container',
{
type: 'right',
defaultTitle: ''
}
],
[
'container',
{
type: 'theorem',
before: info => `<div class="theorem"><p class="title">${info}</p>`,
after: '</div>'
}
],
['smooth-scroll', enableSmoothScroll]
]
}
}