# vitepress-plugin-sidebar

> A vitepress plugin, according to the structure of the files and folders to automatically generate the sidebar.

Latest version **1.0.1** (published 2023-10-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install vitepress-plugin-sidebar
pnpm add vitepress-plugin-sidebar
yarn add vitepress-plugin-sidebar
bun add vitepress-plugin-sidebar
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-10-25 |
| First published | 2023-02-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 22.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | webkong |
| Maintainers | webkong |
| Keywords | vitepress, sidebar, auto, auto sidebar, vitepress config |

## Links

- npm: https://www.npmjs.com/package/vitepress-plugin-sidebar
- Repository: https://github.com/webkong/vitepress-plugin-sidebar
- Homepage: https://github.com/webkong/vitepress-plugin-sidebar#readme
- Issues: https://github.com/webkong/vitepress-plugin-sidebar/issues
- npm.io page: https://npm.io/package/vitepress-plugin-sidebar

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2023-10-25
- 0.0.7 — 2023-02-13
- 0.0.6 — 2023-02-10
- 0.0.5 — 2023-02-10

## README

Generator sidebar for [Vitepress](https://github.com/vuejs/vitepress) based on file and directory structure.

[![NPM version](https://img.shields.io/npm/v/vitepress-plugin-sidebar.svg)](https://www.npmjs.com/package/vitepress-plugin-sidebar) [![NPM downloads](https://img.shields.io/npm/dm/vitepress-plugin-sidebar.svg)](https://www.npmjs.com/package/vitepress-plugin-sidebar) [![NPM License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/webkong/vitepress-plugin-sidebar/blob/master/LICENSE)

# Install

```shell
npm install -D vitepress-plugin-sidebar
```

# API

## sideBar

```javascript
sideBar(docDir = './docs', options?: Options)
```

- **docDir**: `string` Directory to get configuration for, default is `docs`
- **options**: `Options`Option to create configuration

Options:

```typescript
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

```javascript
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.

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

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

## Open collapsed

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

[The configuration for the sidebar in Vitepress](https://vitepress.vuejs.org/config/theme-configs#sidebar)

# License

MIT

Copyright (c) 2022-present, webkong

---
_Source: https://npm.io/package/vitepress-plugin-sidebar · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
