feat(cli): improve templates (#406)

This commit is contained in:
pengzhanbo 2024-12-29 00:39:30 +08:00 committed by GitHub
parent 8dff33a481
commit 045f131ba4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 184 additions and 28 deletions

View File

@ -1,12 +1,22 @@
import { defineClientConfig } from 'vuepress/client'
// import RepoCard from 'vuepress-theme-plume/features/RepoCard.vue'
// import NpmBadge from 'vuepress-theme-plume/features/NpmBadge.vue'
// import NpmBadgeGroup from 'vuepress-theme-plume/features/NpmBadgeGroup.vue'
// import Swiper from 'vuepress-theme-plume/features/Swiper.vue'
// import CustomComponent from './theme/components/Custom.vue'
// import './theme/styles/custom.css'
export default defineClientConfig({
enhance({ app }) {
// built-in components
// app.component('RepoCard', RepoCard)
// app.component('NpmBadge', NpmBadge)
// app.component('NpmBadgeGroup', NpmBadgeGroup)
// app.component('Swiper', Swiper) // you should install `swiper`
// your custom components
// app.component('CustomComponent', CustomComponent)
},
})

View File

@ -21,13 +21,55 @@ export default defineUserConfig({
{{/if}}
bundler: {{ bundler }}Bundler(),
shouldPrefetch: false, // 站点较大,页面数量较多时,不建议启用
theme: plumeTheme({
// 添加您的部署域名
/* 添加您的部署域名, 有助于 SEO, 生成 sitemap */
// hostname: 'https://your_site_url',
// your git repo url
docsRepo: '',
docsDir: '{{ docsDir }}',
/* 文档仓库配置,用于 editLink */
// docsRepo: '',
// docsDir: '{{ docsDir }}',
// docsBranch: '',
/* 页内信息 */
// editLink: true,
// lastUpdated: true,
// contributors: true,
// changelog: false,
/**
* 博客
* @see https://theme-plume.vuejs.press/config/basic/#blog
*/
// blog: false, // 禁用博客
// blog: {
// postList: true, // 是否启用文章列表页
// tags: true, // 是否启用标签页
// archives: true, // 是否启用归档页
// categories: true, // 是否启用分类页
// postCover: 'right', // 文章封面位置
// pagination: 15, // 每页显示文章数量
// },
/* 博客文章页面链接前缀 */
article: '/article/',
/**
* 编译缓存,加快编译速度
* @see https://theme-plume.vuejs.press/config/basic/#cache
*/
cache: 'filesystem',
/**
* 为 markdown 文件自动添加 frontmatter 配置
* @see https://theme-plume.vuejs.press/config/basic/#autofrontmatter
*/
// autoFrontmatter: {
// permalink: true, // 是否生成永久链接
// createTime: true, // 是否生成创建时间
// title: true, // 是否生成标题
// },
plugins: {
/**
@ -35,45 +77,88 @@ export default defineUserConfig({
* @see https://theme-plume.vuejs.press/config/plugins/code-highlight/
*/
// shiki: {
// 强烈建议预设代码块高亮语言,插件默认加载所有语言会产生不必要的时间开销
// // 强烈建议预设代码块高亮语言,插件默认加载所有语言会产生不必要的时间开销
// languages: ['shell', 'bash', 'typescript', 'javascript'],
// twoslash: true, // 启用 twoslash
// whitespace: true, // 启用 空格/Tab 高亮
// lineNumbers: true, // 启用行号
// },
/* 本地搜索, 默认启用 */
// search: true,
/**
* Algolia DocSearch
* 启用此搜索需要将 本地搜索 search 设置为 false
* @see https://theme-plume.vuejs.press/config/plugins/search/#algolia-docsearch
*/
// docsearch: {
// appId: '',
// apiKey: '',
// indexName: '',
// },
/* 文章字数统计、阅读时间,设置为 false 则禁用 */
// readingTime: true,
/**
* markdown enhance
* @see https://theme-plume.vuejs.press/config/plugins/markdown-enhance/
*/
markdownEnhance: {
demo: true,
// include: true,
// chart: true,
// markdownEnhance: {
// demo: true,
// chartjs: true,
// echarts: true,
// mermaid: true,
// flowchart: true,
},
// },
/**
* markdown power
* @see https://theme-plume.vuejs.press/config/plugin/markdown-power/
*/
// markdownPower: {
// pdf: true,
// caniuse: true,
// plot: true,
// bilibili: true,
// youtube: true,
// icons: true,
// codepen: true,
// replit: true,
// codeSandbox: true,
// jsfiddle: true,
// repl: {
// go: true,
// rust: true,
// kotlin: true,
// pdf: true, // 启用 PDF 嵌入 @[pdf](/xxx.pdf)
// caniuse: true, // 启用 caniuse 语法 @[caniuse](feature_name)
// plot: true, // 启用隐秘文本语法 !!xxxx!!
// bilibili: true, // 启用嵌入 bilibili视频 语法 @[bilibili](bid)
// youtube: true, // 启用嵌入 youtube视频 语法 @[youtube](video_id)
// artPlayer: true, // 启用嵌入 artPlayer 本地视频 语法 @[artPlayer](url)
// audioReader: true, // 启用嵌入音频朗读功能 语法 @[audioReader](url)
// icons: true, // 启用内置图标语法 :[icon-name]:
// codepen: true, // 启用嵌入 codepen 语法 @[codepen](user/slash)
// replit: true, // 启用嵌入 replit 语法 @[replit](user/repl-name)
// codeSandbox: true, // 启用嵌入 codeSandbox 语法 @[codeSandbox](id)
// jsfiddle: true, // 启用嵌入 jsfiddle 语法 @[jsfiddle](user/id)
// npmTo: true, // 启用 npm-to 容器 ::: npm-to
// repl: { // 启用 代码演示容器
// go: true, // ::: go-repl
// rust: true, // ::: rust-repl
// kotlin: true, // ::: kotlin-repl
// },
// imageSize: 'local', // 启用 自动填充 图片宽高属性,避免页面抖动
// },
/**
* 在 Markdown 文件中导入其他 markdown 文件内容。
* @see https://theme-plume.vuejs.press/guide/markdown/include/
*/
// markdownInclude: true,
/**
* Markdown 数学公式
* @see https://theme-plume.vuejs.press/config/plugins/markdown-math/
*/
// markdownMath: {
// type: 'katex',
// },
/**
* 水印
* @see https://theme-plume.vuejs.press/guide/features/watermark/
*/
// watermark: true,
/**
* 评论 comments
* @see https://theme-plume.vuejs.press/guide/features/comments/
@ -90,5 +175,11 @@ export default defineUserConfig({
// inputPosition: 'top',
// },
},
/**
* 加密功能
* @see https://theme-plume.vuejs.press/guide/features/encryption/
*/
encrypt: {},
}),
})

View File

@ -13,9 +13,35 @@ import { notes } from './notes'
export default defineThemeConfig({
logo: 'https://theme-plume.vuejs.press/plume.png',
appearance: true,
appearance: true, // 配置 深色模式
social: [
{ icon: 'github', link: '/' },
],
// navbarSocialInclude: ['github'], // 允许显示在导航栏的 social 社交链接
// aside: true, // 页内侧边栏, 默认显示在右侧
// outline: [2, 3], // 页内大纲, 默认显示 h2, h3
/**
* 文章版权信息
* @see https://theme-plume.vuejs.press/guide/features/copyright/
*/
// copyright: true,
// prevPage: true, // 是否启用上一页链接
// nextPage: true, // 是否启用下一页链接
// createTime: true, // 是否显示文章创建时间
/* 站点页脚 */
// footer: {
// message: 'Power by <a target="_blank" href="https://v2.vuepress.vuejs.org/">VuePress</a> & <a target="_blank" href="https://theme-plume.vuejs.press">vuepress-theme-plume</a>',
// copyright: '',
// },
{{#unless multiLanguage}}
/**
* @see https://theme-plume.vuejs.press/config/basic/#profile
*/
profile: {
avatar: 'https://theme-plume.vuejs.press/plume.png',
name: '{{ siteName }}',
@ -27,15 +53,33 @@ export default defineThemeConfig({
navbar,
notes,
/**
* 公告板
* @see https://theme-plume.vuejs.press/guide/features/bulletin/
*/
// bulletin: {
// layout: 'top-right',
// contentType: 'markdown',
// title: '公告板标题',
// content: '公告板内容',
// },
{{/unless}}
social: [
{ icon: 'github', link: '/' },
],
/* 过渡动画 @see https://theme-plume.vuejs.press/config/basic/#transition */
// transition: {
// page: true, // 启用 页面间跳转过渡动画
// postList: true, // 启用 博客文章列表过渡动画
// appearance: 'fade', // 启用 深色模式切换过渡动画, 或配置过渡动画类型
// },
{{#if multiLanguage}}
locales: {
{{#each locales}}
'{{ path }}': {
/**
* @see https://theme-plume.vuejs.press/config/basic/#profile
*/
profile: {
avatar: 'https://theme-plume.vuejs.press/plume.png',
name: '{{ ../siteName }}',
@ -47,6 +91,17 @@ export default defineThemeConfig({
navbar: {{ prefix }}Navbar,
notes: {{ prefix }}Notes,
/**
* 公告板
* @see https://theme-plume.vuejs.press/guide/features/bulletin/
*/
// bulletin: {
// layout: 'top-right',
// contentType: 'markdown',
// title: '',
// content: '',
// },
},
{{/each}}
},