fix: plugins配置改成数组式

This commit is contained in:
xugaoyi 2022-03-08 16:46:20 +08:00
parent 3fd40d0f2f
commit dff4436a89
1 changed files with 67 additions and 90 deletions

View File

@ -2,7 +2,7 @@
* 使JS版本的配置文件可参考https://github.com/xugaoyi/vuepress-theme-vdoing/tree/a2f03e993dd2f2a3afdc57cf72adfc6f1b6b0c32/docs/.vuepress * 使JS版本的配置文件可参考https://github.com/xugaoyi/vuepress-theme-vdoing/tree/a2f03e993dd2f2a3afdc57cf72adfc6f1b6b0c32/docs/.vuepress
*/ */
import { resolve } from 'path' import { resolve } from 'path'
import { defineConfig4CustomTheme } from 'vuepress/config' import { defineConfig4CustomTheme, UserPlugins } from 'vuepress/config'
import { VdoingThemeConfig } from 'vuepress-theme-vdoing/types' import { VdoingThemeConfig } from 'vuepress-theme-vdoing/types'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import baiduCode from './config/baiduCode' // 百度统计hm码 import baiduCode from './config/baiduCode' // 百度统计hm码
@ -222,106 +222,83 @@ export default defineConfig4CustomTheme<VdoingThemeConfig>({
// ], // 网站关联Google AdSense 与 html格式广告支持你可以去掉 // ], // 网站关联Google AdSense 与 html格式广告支持你可以去掉
], ],
// 插件配置 // 插件配置
plugins: { plugins: <UserPlugins>[
// 导入本地插件(供学习参考)
// [resolve(__dirname, './plugins/love-me')]: { // 鼠标点击爱心特效
// color: '#11a8cd', // 爱心颜色,默认随机色
// excludeClassName: 'theme-vdoing-content' // 要排除元素的class, 默认空''
// },
// 百度自动推送 'vuepress-plugin-baidu-autopush', // 百度自动推送
'vuepress-plugin-baidu-autopush': {},
// 百度统计 [
'vuepress-plugin-baidu-tongji': { 'vuepress-plugin-baidu-tongji', // 百度统计
hm: baiduCode, {
}, hm: baiduCode,
},
],
// 全文搜索 // 全文搜索
'fulltext-search': {}, 'fulltext-search',
// 可以添加第三方搜索链接的搜索框(继承原官方搜索框的配置参数) [
// 'thirdparty-search': { 'one-click-copy', // 代码块复制按钮
// thirdparty: [ {
// { copySelector: ['div[class*="language-"] pre', 'div[class*="aside-code"] aside'], // String or Array
// title: '在MDN中搜索', copyMessage: '复制成功', // default is 'Copy successfully and then paste it for use.'
// frontUrl: 'https://developer.mozilla.org/zh-CN/search?q=', // 搜索链接的前面部分 duration: 1000, // prompt message display time.
// behindUrl: '', // 搜索链接的后面部分,可选,默认 '' showInMobile: false, // whether to display on the mobile side, default: false.
// },
// {
// title: '在Runoob中搜索',
// frontUrl: 'https://www.runoob.com/?s=',
// },
// {
// title: '在Vue API中搜索',
// frontUrl: 'https://cn.vuejs.org/v2/api/#',
// },
// {
// title: '在Bing中搜索',
// frontUrl: 'https://cn.bing.com/search?q=',
// },
// {
// title: '通过百度搜索本站的',
// frontUrl: 'https://www.baidu.com/s?wd=site%3Axugaoyi.com%20',
// },
// ],
// },
// 代码块复制按钮
'one-click-copy': {
copySelector: ['div[class*="language-"] pre', 'div[class*="aside-code"] aside'], // String or Array
copyMessage: '复制成功', // default is 'Copy successfully and then paste it for use.'
duration: 1000, // prompt message display time.
showInMobile: false, // whether to display on the mobile side, default: false.
},
// DEMO演示模块, API: https://github.com/xiguaxigua/vuepress-plugin-demo-block
'demo-block': {
settings: {
// jsLib: ['http://xxx'], // 在线示例(jsfiddle, codepen)中的js依赖
// cssLib: ['http://xxx'], // 在线示例中的css依赖
// vue: 'https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js', // 在线示例中的vue依赖
jsfiddle: false, // 是否显示 jsfiddle 链接
codepen: true, // 是否显示 codepen 链接
horizontal: false, // 是否展示为横向样式
}, },
}, ],
// 放大图片 [
'vuepress-plugin-zooming': { 'demo-block', // demo演示模块 https://github.com/xiguaxigua/vuepress-plugin-demo-block
selector: '.theme-vdoing-content img:not(.no-zoom)', // not排除class是no-zoom的图片 {
options: { settings: {
bgColor: 'rgba(0,0,0,0.6)', // jsLib: ['http://xxx'], // 在线示例(jsfiddle, codepen)中的js依赖
// cssLib: ['http://xxx'], // 在线示例中的css依赖
// vue: 'https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js', // 在线示例中的vue依赖
jsfiddle: false, // 是否显示 jsfiddle 链接
codepen: true, // 是否显示 codepen 链接
horizontal: false, // 是否展示为横向样式
},
}, },
}, ],
[
// 评论区 'vuepress-plugin-zooming', // 放大图片
'vuepress-plugin-comment': { {
choosen: 'gitalk', selector: '.theme-vdoing-content img:not(.no-zoom)', // 排除class是no-zoom的图片
options: { options: {
clientID: 'a6e1355287947096b88b', bgColor: 'rgba(0,0,0,0.6)',
clientSecret: 'f0e77d070fabfcd5af95bebb82b2d574d7248d71', },
repo: 'blog-gitalk-comment', // GitHub 仓库
owner: 'xugaoyi', // GitHub仓库所有者
admin: ['xugaoyi'], // 对仓库有写权限的人
// distractionFreeMode: true,
pagerDirection: 'last', // 'first'正序 | 'last'倒序
id: '<%- (frontmatter.permalink || frontmatter.to.path).slice(-16) %>', // 页面的唯一标识,长度不能超过50
title: '「评论」<%- frontmatter.title %>', // GitHub issue 的标题
labels: ['Gitalk', 'Comment'], // GitHub issue 的标签
body:
'页面:<%- window.location.origin + (frontmatter.to.path || window.location.pathname) %>', // GitHub issue 的内容
}, },
}, ],
[
// "上次更新"的时间格式 'vuepress-plugin-comment', // 评论
'@vuepress/last-updated': { {
transformer: (timestamp, lang) => { choosen: 'gitalk',
return dayjs(timestamp).format('YYYY/MM/DD, HH:mm:ss') options: {
clientID: 'a6e1355287947096b88b',
clientSecret: 'f0e77d070fabfcd5af95bebb82b2d574d7248d71',
repo: 'blog-gitalk-comment', // GitHub 仓库
owner: 'xugaoyi', // GitHub仓库所有者
admin: ['xugaoyi'], // 对仓库有写权限的人
// distractionFreeMode: true,
pagerDirection: 'last', // 'first'正序 | 'last'倒序
id: '<%- (frontmatter.permalink || frontmatter.to.path).slice(-16) %>', // 页面的唯一标识,长度不能超过50
title: '「评论」<%- frontmatter.title %>', // GitHub issue 的标题
labels: ['Gitalk', 'Comment'], // GitHub issue 的标签
body:
'页面:<%- window.location.origin + (frontmatter.to.path || window.location.pathname) %>', // GitHub issue 的内容
},
}, },
}, ],
}, [
'@vuepress/last-updated', // "上次更新"时间格式
{
transformer: (timestamp, lang) => {
return dayjs(timestamp).format('YYYY/MM/DD, HH:mm:ss')
},
},
],
],
markdown: { markdown: {
lineNumbers: true lineNumbers: true