docsify-generate-sidebar

1.0.13 • Public • Published

docsify-generate-sidebar

Test

A docsify plugin that generates sidebar based on directory structure.

Install

npm install --save-dev docsify-generate-sidebar

Usage

Add script into package.json:

{
  "scripts": {
    "generate": "docsify-generate-sidebar <content-path> <sidebar-path>"
  }
}

Run script:

npm run generate

By default the root path is considered. You can change this by providing the content-path argument. Likewise sidebat path is by default will be same as the content-path. Change this by passing sidebar-path

For Example, the below structure

pages 
│
└───01-Parent_With_Readme
│   │   README.md
│   │
│   └───Child
│       │   README.md
│       │   01-ChildContent.md
│       |   02-ChildContent.md
│   
└───02-Parent_Without_Readme
│   |
│   └───Child
│       │   README.md
│       │   A-ChildContent.md
│       │   B-ChildContent.md
│       └───SubChild
│           │   README.md
│           └───SubChildContent1.md

will be generate as below:

- [Parent_With_Readme](pages/01-Parent_With_Readme/README.md)
  - [Child](pages/01-Parent_With_Readme/Child/README.md)
    - [ChildContent](pages/01-Parent_With_Readme/Child/01-ChildContent.md)
    - [ChildContent](pages/01-Parent_With_Readme/Child/02-ChildContent.md)
- Parent_Without_Readme
  - [Child](pages/02-Parent_Without_Readme/Child/README.md)
    - [ChildContent](pages/02-Parent_Without_Readme/Child/A-ChildContent.md)
    - [ChildContent](pages/02-Parent_Without_Readme/Child/B-ChildContent.md)
    - [SubChild](pages/02-Parent_Without_Readme/Child/SubChild/README.md)
      - [SubChildContent1](pages/02-Parent_Without_Readme/Child/SubChild/SubChildContent1.md)

[!NOTE] The symbol - is considered as seperator. You can order the files with numbers separated by filenames. Only the names after seperator will be considered.

Todo

  • Add config to get files/filepaths that need to ignored
  • Add release action in github
  • Add support for directories with space

Package Sidebar

Install

npm i docsify-generate-sidebar

Weekly Downloads

2

Version

1.0.13

License

MIT

Unpacked Size

11.3 kB

Total Files

13

Last publish

Collaborators

  • themyth333