--- title: 文档/知识笔记 author: pengzhanbo icon: teenyicons:doc-outline createTime: 2024/03/04 15:45:34 permalink: /guide/document/ tags: - 指南 - 快速开始 --- ## 概述 在本主题满足了 Blog 的基本功能后,期望能够 以 note 或者 book 的形式聚合文章,形式上类似于 vuepress 默认主题。 同时也减少配置的复杂度。 它能够让你以更加友好的方式,组织管理你的文档。 ## 目录 文档/知识笔记 默认存放在 `{sourceDir}/notes` 目录下。 示例: ``` {sourceDir}/ ├─ notes/ ├─ typescript/ │ ├─ foo.md ├─ rust/ │ ├─ foo.md ``` 其中,`typescript` 和 `rust` 为目录名,各自独立保存与之相关的 markdown 文件。 ## 配置 ```js import { defineUserConfig } from 'vuepress' import { themePlume } from 'vuepress-theme-plume' export default defineUserConfig({ theme: themePlume({ notes: { dir: '/notes/', // 声明所有笔记的目录 link: '/', // 声明所有笔记默认的链接前缀, 默认为 '/' notes: [ { dir: 'typescript', // 声明笔记的目录,相对于 `notes.dir` link: '/typescript/', // 声明笔记的链接前缀 sidebar: [ // 配置侧边栏 { text: '简介', icon: 'mdi:language-typescript', // 侧边栏图标 items: ['foo'] // 简化写法,主题会自动补全为 `foo.md` } ] }, { dir: 'rust', link: '/rust/', sidebar: [ { text: '简介', items: ['foo'] } ] } ] } }) }) ``` 主题会根据配置,为对应目录中的 md 文件,生成 永久链接,以及侧边栏。 ::: tip 你应该在创建文件之前,先把笔记的目录和链接前缀等配置好,主题需要根据配置, 为目录中的 md 文件生成永久链接,以及侧边栏。 ::: 完整配置查看 [notes配置](/config/notes/)