npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vite-plugin-vitepress-auto-nav

v4.0.0

Published

Auto-generate VitePress default-theme nav and sidebar from runtime pages

Readme

vite-plugin-vitepress-auto-nav

中文文档

Auto-generate VitePress default-theme nav and sidebar from runtime pages.

Features

  • Use top-level directories to generate nav when the user has not defined one, and lower-level directories to generate sidebar that always replaces the user config.
  • Support rewrites, dynamic routes, and i18n.
  • Support custom display names for folders and pages, with optional H1-based titles for pages.
  • Support visibility control and sorting for both folders and pages.
  • Support folder collapsed state in sidebar, matching the default theme behavior.
  • Support treating index.md as either a folder link or a standalone page.

Quick start

  1. Install
npm install -D vite-plugin-vitepress-auto-nav
  1. Add the plugin in .vitepress/config.ts
import { defineConfig } from 'vitepress'
import AutoNav from 'vite-plugin-vitepress-auto-nav'

export default defineConfig({
  vite: {
    plugins: [AutoNav()],
  },
})
  1. Configure the plugin if needed. Decide whether you also want to keep a custom themeConfig.nav. In most projects the top nav has only a few entries, so the plugin leaves room for manual nav customization.

  2. Start VitePress as usual

Configuration

| Current param | Type | Default | Description | | ---------------------- | ----------------------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------ | | include | string \| string[] | - | Plugin include rules, resolved as glob patterns relative to VitePress srcDir. | | exclude | string \| string[] | - | Plugin exclude rules, resolved as glob patterns relative to VitePress srcDir. | | standaloneIndex | boolean | false | Controls how index.md is mounted inside a folder: false keeps it as the folder link, true keeps it as a standalone page. | | overrides | Record<string, ItemMetaOptions> | {} | Entry override config. Keys can be filenames, folder names, or relative paths. If names collide, prefer relative paths. | | frontmatterKeyPrefix | string | '' | Adds a prefix to plugin frontmatter keys to avoid conflicts with existing site fields. | | sorter | (a, b, frontmatterKeyPrefix?) => number | defaultSorter | Sort function for sibling nodes. The function input includes overrides.order. | | preferArticleTitle | boolean | false | Whether page H1 should be preferred globally as the navigation label. Lower priority than displayName. | | dev | AutoNavDevOptions | See below | Development options for watch debounce, content cache, and log output. | | ❌ | - | - | SUMMARY.md-based generation is no longer supported. |

overrides (ItemMetaOptions)

The same option names can also be used in Markdown frontmatter. If your project already uses these field names, add a prefix with frontmatterKeyPrefix, for example navDisplayName, navOrder, or navVisible.

| Current param | Type | Default | Description | | -------------------- | --------- | ------- | -------------------------------------------------------------------------------------------------------------------- | | displayName | string | - | Custom label for a file or folder entry. Higher priority than preferArticleTitle and the default file/folder name. | | visible | boolean | true | Controls whether the entry appears in navigation. | | order | number | - | Sort weight passed into sorter. Smaller values come first. | | preferArticleTitle | boolean | false | Whether to read the page H1 as the display label for this entry. | | collapsed | boolean | - | Default collapsed state for folder entries. |

dev (AutoNavDevOptions)

| Current param | Type | Default | Description | | ----------------- | ------------------------------- | -------- | --------------------------------------------------------------------------------------------------------- | | watchDebounceMs | number | 1500 | File watcher debounce time in milliseconds, used to avoid recalculating too often during rapid edits. | | cache | boolean | true | Whether to reuse parsed content metadata cache in development. | | logLevel | 'silent' \| 'info' \| 'debug' | 'info' | Development log level. Switch to debug when checking path resolution, merged output, or watch behavior. |

Migrating from v3

Paste the section below into an AI model to get a fast migration.

Upgrade this project from vite-plugin-vitepress-auto-nav v3 to the latest version.

First, update the package:
- npm: `npm install -D vite-plugin-vitepress-auto-nav@latest`
- pnpm: `pnpm add -D vite-plugin-vitepress-auto-nav@latest`
- yarn: `yarn add -D vite-plugin-vitepress-auto-nav@latest`

Then migrate the config with these rules:

Rename these top-level options:
- `pattern` -> `include`
- `itemsSetting` -> `overrides`
- `frontmatterPrefix` -> `frontmatterKeyPrefix`
- `compareFn` -> `sorter`
- `useArticleTitle` -> `preferArticleTitle`

Rename these item/frontmatter fields:
- `title` -> `displayName`
- `sort` -> `order`
- `useArticleTitle` -> `preferArticleTitle`

Invert these booleans:
- `indexAsFolderLink` -> `standaloneIndex`, using `standaloneIndex = !indexAsFolderLink`
- `hide` -> `visible`, using `visible = !hide`

New options you may add if needed:
- `exclude`
- `dev.watchDebounceMs`
- `dev.cache`
- `dev.logLevel`

Important summary rule:
- If the existing config contains any `summary` option, `SUMMARY.md` workflow, or other summary-based generation logic, stop the migration at that point and explicitly report that summary-based generation is no longer supported in the latest version.

Migration rules:
1. Replace renamed keys directly.
2. Convert inverted booleans using the formulas above.
3. Keep unrelated VitePress config unchanged.

Output requirements:
- Return the migrated config code only.
- Preserve existing comments when possible.
- If summary-based config is detected, do not output migrated code. Output a short explanation that summary is no longer supported and ask for the page structure or content organization rules before continuing.

Development scripts

  • pnpm build
  • pnpm lint
  • pnpm lint:fix
  • pnpm format
  • pnpm test
  • pnpm test:unit
  • pnpm test:unit:coverage
  • pnpm test:integration
  • pnpm test:watch

License

MIT License © 2023 Xaviw