0.0.5 • Published 2 years ago

vitepress-auto-nav-sidebar v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

vitepress-auto-nav-sidebar

OSCS Status

vitepress导航栏自动生成

效果预览

Feature

  • 支持功能
    • 自动生成nav和sidebar配置
    • TypeScript支持
    • 目录/文件前缀设置,默认为「 📂 」/「 ✏️ 」
    • 目录/文件的过滤
  • 下一步优化
    • 插件配置待丰富
    • 过滤支持正则

Usage

  1. 安装插件
pnpm i vitepress-auto-nav-sidebar
  1. vuepress配置中使用插件,示例如下
import AutoNavPlugin from 'vitepress-auto-nav-sidebar'

const { nav, sidebar } = AutoNavPlugin({
  ignoreFolders: ["node_modules", "assets", "public", ".vuepress", "code", ".obsidian", "utils"], // 需要排除的一些目录
  ignoreFiles: ['个人简历'], // 需要排除的一些文件
  dirPrefix: '目录:',
  filePrefix: '文件:',
  showNavIcon:false,
  showSideIcon:true,
  isCollapse: true,
  collapsed: true,
  singleLayerNav:true
})
module.exports = {
  themeConfig: {
    nav,
    sidebar,
  },
};

Options

属性类型默认值描述
entryString'docs'设置相对于项目根目录的检索入口
singleLayerNavBooleanfalse是否设置单层nav
showSideIconBooleanfalse显示sidebar修饰
showNavIconBooleantrue显示nav修饰
isCollapsibleBooleantruesidebar是否可折叠
ignoreFoldersString[][]需要排除的一些目录
ignoreFilesString[][]需要排除的一些文件
filePrefixString✏️文件前缀修饰,有助于区分
dirPrefixString📂目录前缀修饰,有助于区分
collapsedBooleanfalsesidebar默认不折叠
customParentFolderNameString''自定义侧边栏父文件夹的显示文本,不设置或为空还是默认显示原父文件夹名