1.0.1 • Published 7 months ago

vitepress-plugin-sidebar v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Generator sidebar for Vitepress based on file and directory structure.

NPM version NPM downloads NPM License

Install

npm install -D vitepress-plugin-sidebar

API

sideBar

sideBar(docDir = './docs', options?: Options)
  • docDir: string Directory to get configuration for, default is docs
  • options: OptionsOption to create configuration

Options:

interface Options {
  ignoreDirectory?: Array<string>; // Directoty path to ignore.
  ignoreMDFiles?: Array<string>; // File path to ignore.
  // If `true`, group is collapsible and collapsed by default
  // If `false`, group is collapsible but expanded by default
  collapsed?: boolean;
  // If not specified, group is not collapsible.
  collapsible?: boolean;
  // Default is true. Set false, will not remove number prefix, this options is for sort.
  // "01.xxx" -> "xxx"
  pure?: boolean;
}

Usage

import { sideBar } from "vitepress-plugin-sidebar";

module.exports = {
  // ...
  themeConfig: {
    // ...
    sidebar: sideBar(),
  },
};

Ignore Some path

You can pass options to keep some path out of the sidebar.

import { sideBar } from "vitepress-plugin-sidebar";

module.exports = {
  // ...
  themeConfig: {
    // ...
    sidebar: sideBar("docs", {
      ignoreMDFiles: ["index"],
      ignoreDirectory: ["node_modules"],
    }),
  },
};

Open collapsed

module.exports = {
  // ...
  themeConfig: {
    // ...
    sidebar: sideBar("docs", {
      ignoreMDFiles: ["index"],
      ignoreDirectory: ["node_modules"],
      collapsed: false,
      collapsible: true, 
    }),
  },
};

The configuration for the sidebar in Vitepress

License

MIT

Copyright (c) 2022-present, webkong

1.0.1

7 months ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.1

2 years ago