docs: update notes config

This commit is contained in:
pengzhanbo 2024-08-30 22:31:34 +08:00
parent 220940b2a5
commit 2443f99f46
10 changed files with 270 additions and 167 deletions

View File

@ -1,165 +0,0 @@
import { defineNotesConfig } from 'vuepress-theme-plume'
export const zhNotes = defineNotesConfig({
dir: 'notes',
link: '/',
notes: [
{
dir: 'theme/guide',
link: '/guide/',
sidebar: [
{
text: '快速开始',
collapsed: false,
icon: 'carbon:idea',
items: ['介绍', '安装与使用', '博客', '知识笔记', '编写文章', '国际化', '部署'],
},
{
text: '写作',
icon: 'fluent-mdl2:edit-create',
collapsed: false,
items: [
{
text: 'markdown',
icon: 'material-symbols:markdown-outline',
prefix: 'markdown',
collapsed: true,
items: ['基础', '扩展', '进阶'],
},
{
text: '代码块',
prefix: '代码',
icon: 'ph:code-bold',
collapsed: true,
items: ['介绍', '特性支持', '代码组', '导入代码', 'twoslash'],
},
{
text: '代码演示',
prefix: '代码演示',
icon: 'carbon:demo',
collapsed: true,
items: ['前端', 'rust', 'golang', 'kotlin', 'codepen', 'jsFiddle', 'codeSandbox', 'replit'],
},
{
text: '图表',
icon: 'mdi:chart-line',
prefix: '图表',
collapsed: true,
items: ['chart', 'echarts', 'mermaid', 'flowchart'],
},
{
text: '资源嵌入',
icon: 'dashicons:embed-video',
prefix: '嵌入',
collapsed: true,
items: ['pdf', 'bilibili', 'youtube'],
},
],
},
{
text: '功能',
icon: 'lucide:box',
collapsed: false,
prefix: '功能',
items: ['图标', '代码复制', '内容搜索', '评论', '加密', '文章水印', '友情链接页', 'seo', 'sitemap'],
},
{
text: '组件',
prefix: '组件',
icon: 'uiw:component',
collapsed: false,
items: ['徽章', '图标', '隐秘文本', '卡片', '链接卡片', '图片卡片', '卡片容器', '首页布局容器', 'repoCard', 'npmBadge'],
},
{
text: '自定义',
icon: 'material-symbols:dashboard-customize-outline-rounded',
collapsed: false,
items: ['自定义首页', '自定义样式', '布局插槽', '组件覆写'],
},
{
text: 'API',
icon: 'mdi:api',
collapsed: false,
items: ['api-客户端', 'api-node'],
},
],
},
{
dir: 'theme/config',
link: '/config/',
sidebar: [
{
text: '配置',
collapsed: false,
items: [
'配置说明',
'多语言配置',
'主题配置',
'导航栏配置',
'notes配置',
'侧边栏配置',
],
},
{
text: 'frontmatter',
prefix: 'frontmatter',
collapsed: false,
items: ['basic', 'home', 'post', 'friend'],
},
{
text: '内置插件',
prefix: 'plugins',
collapsed: false,
items: ['', '代码高亮', '搜索', '阅读统计', 'markdown增强', 'markdownPower', '百度统计', '水印'],
},
],
},
{
dir: 'plugins',
link: '/plugins/',
sidebar: [
{
text: '插件',
link: '/plugins/',
items: [
// 'caniuse',
// 'iconify',
'shiki',
'md-power',
'content-updated',
{
text: 'plugin-netlify-functions',
dir: 'netlify-functions',
link: '/plugins/plugin-netlify-functions/',
collapsed: true,
items: [
'介绍',
'使用',
'功能',
'api',
'functions',
],
},
],
},
],
},
{
dir: 'tools',
link: '/tools/',
sidebar: [
{
text: '工具',
icon: 'tabler:tools',
items: ['custom-theme', 'home-hero-tint-plate', 'caniuse'],
},
],
},
],
})
export const enNotes = defineNotesConfig({
dir: 'en/notes',
link: '/',
notes: [],
})

View File

@ -0,0 +1,7 @@
import { defineNotesConfig } from 'vuepress-theme-plume'
export const enNotes = defineNotesConfig({
dir: 'en/notes',
link: '/',
notes: [],
})

View File

@ -0,0 +1,2 @@
export * from './en/index.js'
export * from './zh/index.js'

View File

@ -0,0 +1,16 @@
import { defineNotesConfig } from 'vuepress-theme-plume'
import { themeGuide } from './theme-guide'
import { themeConfig } from './theme-config'
import { plugins } from './plugins'
import { tools } from './tools'
export const zhNotes = defineNotesConfig({
dir: 'notes',
link: '/',
notes: [
themeGuide,
themeConfig,
plugins,
tools,
],
})

View File

@ -0,0 +1,32 @@
import { defineNoteConfig } from 'vuepress-theme-plume'
export const plugins = defineNoteConfig({
dir: 'plugins',
link: '/plugins/',
sidebar: [
{
text: '插件',
link: '/plugins/',
items: [
// 'caniuse',
// 'iconify',
'shiki',
'md-power',
'content-updated',
{
text: 'plugin-netlify-functions',
dir: 'netlify-functions',
link: '/plugins/plugin-netlify-functions/',
collapsed: true,
items: [
'介绍',
'使用',
'功能',
'api',
'functions',
],
},
],
},
],
})

View File

@ -0,0 +1,46 @@
import { defineNoteConfig } from 'vuepress-theme-plume'
export const themeConfig = defineNoteConfig({
dir: 'theme/config',
link: '/config/',
sidebar: [
{
text: '配置',
collapsed: false,
items: [
'配置说明',
'多语言配置',
'主题配置',
'导航栏配置',
'notes配置',
'侧边栏配置',
],
},
{
text: 'frontmatter',
prefix: 'frontmatter',
collapsed: false,
items: [
'basic',
'home',
'post',
'friend',
],
},
{
text: '内置插件',
prefix: 'plugins',
collapsed: false,
items: [
'',
'代码高亮',
'搜索',
'阅读统计',
'markdown增强',
'markdownPower',
'百度统计',
'水印',
],
},
],
})

View File

@ -0,0 +1,147 @@
import { defineNoteConfig } from 'vuepress-theme-plume'
export const themeGuide = defineNoteConfig({
dir: 'theme/guide',
link: '/guide/',
sidebar: [
{
text: '快速开始',
collapsed: false,
icon: 'carbon:idea',
items: [
'介绍',
'安装与使用',
'博客',
'知识笔记',
'编写文章',
'国际化',
'部署',
],
},
{
text: '写作',
icon: 'fluent-mdl2:edit-create',
collapsed: false,
items: [
{
text: 'markdown',
icon: 'material-symbols:markdown-outline',
prefix: 'markdown',
collapsed: true,
items: [
'基础',
'扩展',
'进阶',
],
},
{
text: '代码块',
prefix: '代码',
icon: 'ph:code-bold',
collapsed: true,
items: [
'介绍',
'特性支持',
'代码组',
'导入代码',
'twoslash',
],
},
{
text: '代码演示',
prefix: '代码演示',
icon: 'carbon:demo',
collapsed: true,
items: [
'前端',
'rust',
'golang',
'kotlin',
'codepen',
'jsFiddle',
'codeSandbox',
'replit',
],
},
{
text: '图表',
icon: 'mdi:chart-line',
prefix: '图表',
collapsed: true,
items: [
'chart',
'echarts',
'mermaid',
'flowchart',
],
},
{
text: '资源嵌入',
icon: 'dashicons:embed-video',
prefix: '嵌入',
collapsed: true,
items: [
'pdf',
'bilibili',
'youtube',
],
},
],
},
{
text: '功能',
icon: 'lucide:box',
collapsed: false,
prefix: '功能',
items: [
'图标',
'代码复制',
'内容搜索',
'评论',
'加密',
'文章水印',
'友情链接页',
'seo',
'sitemap',
],
},
{
text: '组件',
prefix: '组件',
icon: 'uiw:component',
collapsed: false,
items: [
'徽章',
'图标',
'隐秘文本',
'卡片',
'链接卡片',
'图片卡片',
'卡片容器',
'首页布局容器',
'repoCard',
'npmBadge',
],
},
{
text: '自定义',
icon: 'material-symbols:dashboard-customize-outline-rounded',
collapsed: false,
items: [
'自定义首页',
'自定义样式',
'布局插槽',
'组件覆写',
],
},
{
text: 'API',
icon: 'mdi:api',
collapsed: false,
items: [
'api-客户端',
'api-node',
],
},
],
})

View File

@ -0,0 +1,17 @@
import { defineNoteConfig } from 'vuepress-theme-plume'
export const tools = defineNoteConfig({
dir: 'tools',
link: '/tools/',
sidebar: [
{
text: '工具',
icon: 'tabler:tools',
items: [
'custom-theme',
'home-hero-tint-plate',
'caniuse',
],
},
],
})

View File

@ -1,5 +1,5 @@
import { defineThemeConfig } from 'vuepress-theme-plume'
import { enNotes, zhNotes } from './notes.js'
import { enNotes, zhNotes } from './notes/index.js'
import { enNavbar, zhNavbar } from './navbar.js'
export default defineThemeConfig({

View File

@ -40,8 +40,9 @@ export function plumeTheme(options: PlumeThemeOptions = {}): Theme {
templateBuildRenderer,
extendsMarkdown: async (_, app) => {
const { autoFrontmatter } = await waitForConfigLoaded()
const { autoFrontmatter, localeOptions } = await waitForConfigLoaded()
if (autoFrontmatter !== false) {
initAutoFrontmatter(localeOptions, autoFrontmatter)
await generateAutoFrontmatter(app)
// wait for autoFrontmatter generated
// i/o performance