From dff4436a89e94ab678944cd84108eb61e21e4520 Mon Sep 17 00:00:00 2001 From: xugaoyi <894072666@qq.com> Date: Tue, 8 Mar 2022 16:46:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20plugins=E9=85=8D=E7=BD=AE=E6=94=B9?= =?UTF-8?q?=E6=88=90=E6=95=B0=E7=BB=84=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/config.ts | 157 +++++++++++++++++---------------------- 1 file changed, 67 insertions(+), 90 deletions(-) diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts index 30279a6..613fadc 100644 --- a/docs/.vuepress/config.ts +++ b/docs/.vuepress/config.ts @@ -2,7 +2,7 @@ * 提示:如您想使用JS版本的配置文件可参考:https://github.com/xugaoyi/vuepress-theme-vdoing/tree/a2f03e993dd2f2a3afdc57cf72adfc6f1b6b0c32/docs/.vuepress */ import { resolve } from 'path' -import { defineConfig4CustomTheme } from 'vuepress/config' +import { defineConfig4CustomTheme, UserPlugins } from 'vuepress/config' import { VdoingThemeConfig } from 'vuepress-theme-vdoing/types' import dayjs from 'dayjs' import baiduCode from './config/baiduCode' // 百度统计hm码 @@ -222,106 +222,83 @@ export default defineConfig4CustomTheme({ // ], // 网站关联Google AdSense 与 html格式广告支持(你可以去掉) ], + // 插件配置 - plugins: { - // 导入本地插件(供学习参考) - // [resolve(__dirname, './plugins/love-me')]: { // 鼠标点击爱心特效 - // color: '#11a8cd', // 爱心颜色,默认随机色 - // excludeClassName: 'theme-vdoing-content' // 要排除元素的class, 默认空'' - // }, + plugins: [ - // 百度自动推送 - 'vuepress-plugin-baidu-autopush': {}, + 'vuepress-plugin-baidu-autopush', // 百度自动推送 - // 百度统计 - 'vuepress-plugin-baidu-tongji': { - hm: baiduCode, - }, + [ + 'vuepress-plugin-baidu-tongji', // 百度统计 + { + hm: baiduCode, + }, + ], // 全文搜索 - 'fulltext-search': {}, + 'fulltext-search', - // 可以添加第三方搜索链接的搜索框(继承原官方搜索框的配置参数) - // 'thirdparty-search': { - // thirdparty: [ - // { - // title: '在MDN中搜索', - // frontUrl: 'https://developer.mozilla.org/zh-CN/search?q=', // 搜索链接的前面部分 - // behindUrl: '', // 搜索链接的后面部分,可选,默认 '' - // }, - // { - // 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, // 是否展示为横向样式 + [ + '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. }, - }, + ], - // 放大图片 - 'vuepress-plugin-zooming': { - selector: '.theme-vdoing-content img:not(.no-zoom)', // not排除class是no-zoom的图片 - options: { - bgColor: 'rgba(0,0,0,0.6)', + [ + 'demo-block', // demo演示模块 https://github.com/xiguaxigua/vuepress-plugin-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-comment': { - choosen: 'gitalk', - 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-plugin-zooming', // 放大图片 + { + selector: '.theme-vdoing-content img:not(.no-zoom)', // 排除class是no-zoom的图片 + options: { + bgColor: 'rgba(0,0,0,0.6)', + }, }, - }, - - // "上次更新"的时间格式 - '@vuepress/last-updated': { - transformer: (timestamp, lang) => { - return dayjs(timestamp).format('YYYY/MM/DD, HH:mm:ss') + ], + [ + 'vuepress-plugin-comment', // 评论 + { + choosen: 'gitalk', + 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: { lineNumbers: true