diff options
Diffstat (limited to 'doc/docs/.vuepress/theme/index.js')
-rw-r--r-- | doc/docs/.vuepress/theme/index.js | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/doc/docs/.vuepress/theme/index.js b/doc/docs/.vuepress/theme/index.js new file mode 100644 index 0000000..baaf102 --- /dev/null +++ b/doc/docs/.vuepress/theme/index.js | |||
@@ -0,0 +1,59 @@ | |||
1 | const path = require('path') | ||
2 | |||
3 | // Theme API. | ||
4 | module.exports = (options, ctx) => { | ||
5 | const { themeConfig, siteConfig } = ctx | ||
6 | |||
7 | // resolve algolia | ||
8 | const isAlgoliaSearch = ( | ||
9 | themeConfig.algolia | ||
10 | || Object | ||
11 | .keys(siteConfig.locales && themeConfig.locales || {}) | ||
12 | .some(base => themeConfig.locales[base].algolia) | ||
13 | ) | ||
14 | |||
15 | const enableSmoothScroll = themeConfig.smoothScroll === true | ||
16 | |||
17 | return { | ||
18 | alias () { | ||
19 | return { | ||
20 | '@AlgoliaSearchBox': isAlgoliaSearch | ||
21 | ? path.resolve(__dirname, 'components/AlgoliaSearchBox.vue') | ||
22 | : path.resolve(__dirname, 'noopModule.js') | ||
23 | } | ||
24 | }, | ||
25 | |||
26 | plugins: [ | ||
27 | ['@vuepress/active-header-links', options.activeHeaderLinks], | ||
28 | '@vuepress/search', | ||
29 | '@vuepress/plugin-nprogress', | ||
30 | ['container', { | ||
31 | type: 'tip', | ||
32 | defaultTitle: { | ||
33 | '/': 'TIP', | ||
34 | '/zh/': '提示' | ||
35 | } | ||
36 | }], | ||
37 | ['container', { | ||
38 | type: 'warning', | ||
39 | defaultTitle: { | ||
40 | '/': 'WARNING', | ||
41 | '/zh/': '注意' | ||
42 | } | ||
43 | }], | ||
44 | ['container', { | ||
45 | type: 'danger', | ||
46 | defaultTitle: { | ||
47 | '/': 'WARNING', | ||
48 | '/zh/': '警告' | ||
49 | } | ||
50 | }], | ||
51 | ['container', { | ||
52 | type: 'details', | ||
53 | before: info => `<details class="custom-block details">${info ? `<summary>${info}</summary>` : ''}\n`, | ||
54 | after: () => '</details>\n' | ||
55 | }], | ||
56 | ['smooth-scroll', enableSmoothScroll] | ||
57 | ] | ||
58 | } | ||
59 | } | ||