mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-11 06:16:08 +10:00
58 lines
1.4 KiB
JavaScript
58 lines
1.4 KiB
JavaScript
const path = require('path')
|
|
|
|
// Theme API.
|
|
module.exports = (options, ctx) => ({
|
|
alias () {
|
|
const { themeConfig, siteConfig } = ctx
|
|
// resolve algolia
|
|
const isAlgoliaSearch = (
|
|
themeConfig.algolia
|
|
|| Object.keys(siteConfig.locales && themeConfig.locales || {})
|
|
.some(base => themeConfig.locales[base].algolia)
|
|
)
|
|
return {
|
|
'@AlgoliaSearchBox': isAlgoliaSearch
|
|
? path.resolve(__dirname, 'components/AlgoliaSearchBox.vue')
|
|
: path.resolve(__dirname, 'noopModule.js')
|
|
}
|
|
},
|
|
|
|
plugins: [
|
|
['@vuepress/active-header-links', options.activeHeaderLinks],
|
|
'@vuepress/search',
|
|
'@vuepress/plugin-nprogress',
|
|
['container', {
|
|
type: 'tip',
|
|
defaultTitle: {
|
|
'/zh/': '提示'
|
|
}
|
|
}],
|
|
['container', {
|
|
type: 'warning',
|
|
defaultTitle: {
|
|
'/zh/': '注意'
|
|
}
|
|
}],
|
|
['container', {
|
|
type: 'danger',
|
|
defaultTitle: {
|
|
'/zh/': '警告'
|
|
}
|
|
}],
|
|
['prism', {
|
|
theme: 'tomorrow',
|
|
preview: {
|
|
'/': {
|
|
beforeCodeBlock: '<p><strong>Input</strong></p>\n',
|
|
beforePreview: '<p><strong>Output</strong></p>\n'
|
|
},
|
|
'/zh/': {
|
|
beforeCodeBlock: '<p><strong>输入</strong></p>\n',
|
|
beforePreview: '<p><strong>输出</strong></p>\n'
|
|
}
|
|
}
|
|
}],
|
|
['import-code']
|
|
]
|
|
})
|