# @limy-org/vite-plugin-vitepress-auto-sidebar

> Automatically generate VitePress sidebar

Latest version **1.0.1** (published 2023-04-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install @limy-org/vite-plugin-vitepress-auto-sidebar
pnpm add @limy-org/vite-plugin-vitepress-auto-sidebar
yarn add @limy-org/vite-plugin-vitepress-auto-sidebar
bun add @limy-org/vite-plugin-vitepress-auto-sidebar
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-04-06 |
| First published | 2023-04-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | limy1997 |
| Keywords | vite-plugin, vitepress, sidebar, auto sidebar, autobar |

## Links

- npm: https://www.npmjs.com/package/@limy-org/vite-plugin-vitepress-auto-sidebar
- Homepage: https://github.com/mingyuLi97/vite-plugin-vitepress-auto-sidebar
- npm.io page: https://npm.io/package/@limy-org/vite-plugin-vitepress-auto-sidebar

## Dependencies (1)

- [glob](https://npm.io/package/glob.md) ^9.3.4

## 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-04-06
- 1.0.0 — 2023-04-06

## README

<h2 align='center'><samp>vite-plugin-vitepress-auto-sidebar</samp></h2>

<p align='center'>Automatically generate VitePress sidebar</p>

<p align='center'>
  <a href='https://www.npmjs.com/package/@limy-org/vite-plugin-vitepress-auto-sidebar'>
    <img src='https://img.shields.io/npm/v/@limy-org/vite-plugin-vitepress-auto-sidebar?color=222&style=flat-square'>
  </a>
  <a href='https://github.com/mingyuLi97/vite-plugin-vitepress-auto-sidebar/blob/master/LICENSE'>
    <img src='https://img.shields.io/badge/license-MIT-blue.svg'>
  </a>
</p>

## Features

- 🪄 Automatic sidebar generation
- ✨ Title of files synchronized with sidebar
- 🚀 Automatic reload when files are deleted or title is modified
- ✔️ Customizable configuration options (custom directory names, custom file sorting).

## Installation

```bash
# pnpm
pnpm i @limy-org/vite-plugin-vitepress-auto-sidebar
# yarn
yarn add @limy-org/vite-plugin-vitepress-auto-sidebar
# npm
npm install @limy-org/vite-plugin-vitepress-auto-sidebar
```

## Usage

```ts
// .vitepress/config.ts
import VitePluginAutoSidebar from "@limy-org/vite-plugin-vitepress-auto-sidebar";
export default defineConfig({
  vite: {
    plugins: [
      VitePluginAutoSidebar({
        sidebarResolved(value) {
          console.log(value);
          // do sort
          value["/dir2/"][0].items?.sort((a, b) => a.text - b.text);
          // rename
          value["/dir2/"][0].text = 'sorted'
        },
        ignores: ["index.md"],
        root: process.cwd(),
      }),
    ],
  },
});
```

## How it work

```
├── .vitepress
├── dir1
│   ├── dir1-1
│   │   ├── 1.md
│   │   ├── 2.md
│   │   └── dir1-1-1
│   │       └── 1.md
│   └── dir1-2
│       └── 1.md
├── dir2
│   └── 2-2
│       ├── 2.md
│       └── 3.md
├── index.md
├── node_modules
└── package.json

TO


{
  "/dir2/": [
    {
      "text": "2-2",
      "collapsed": false,
      "items": [
        {
          "text": "2-2",
          "link": "/dir2/2-2/3.md"
        },
        {
          "text": "222",
          "link": "/dir2/2-2/2.md"
        }
      ]
    }
  ],
  "/dir1/": [
    {
      "text": "dir1-2",
      "collapsed": false,
      "items": [
        {
          "text": "1-2",
          "link": "/dir1/dir1-2/1.md"
        }
      ]
    },
    {
      "text": "dir1-1",
      "collapsed": false,
      "items": [
        {
          "text": "2222",
          "link": "/dir1/dir1-1/2.md"
        },
        {
          "text": "1-1",
          "link": "/dir1/dir1-1/1.md"
        },
        {
          "text": "dir1-1-1",
          "collapsed": false,
          "items": [
            {
              "text": "1-1-1",
              "link": "/dir1/dir1-1/dir1-1-1/1.md"
            }
          ]
        }
      ]
    }
  ]
}
```

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