diff options
| author | Li Jin <dragon-fly@qq.com> | 2021-04-19 23:41:33 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2021-04-19 23:41:33 +0800 |
| commit | 5d3b07801456d16dcc2c75dcccd48d508a6b60cc (patch) | |
| tree | 2df1a154bf58d93f2475df02afbd15f1a8ba2963 /doc/docs/.vuepress/theme/index.js | |
| parent | ea82666506b57d6e905b7f2e5fe78498fe5a7abd (diff) | |
| download | yuescript-5d3b07801456d16dcc2c75dcccd48d508a6b60cc.tar.gz yuescript-5d3b07801456d16dcc2c75dcccd48d508a6b60cc.tar.bz2 yuescript-5d3b07801456d16dcc2c75dcccd48d508a6b60cc.zip | |
first commit for Yuescript document site.
Diffstat (limited to '')
| -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 | } | ||
