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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mbertogliati/docsify-sidebar-collapse

v1.0.5

Published

A collapsible sidebar plugin for Docsify. Adds toggle buttons to collapse/expand sidebar sections. Not compatible with nested sidebars.

Downloads

9

Readme

Docsify Sidebar Collapse

A lightweight Docsify plugin that adds collapse/expand toggles to your sidebar sections.

  • Collapses/expands second-level sidebar sections with a smooth transition
  • Remembers collapsed state across page navigations via localStorage
  • Works with default Docsify themes and aims to be compatible with docsify-themable
  • Ships both JS and CSS; simply include both to enable it

Note: This plugin is NOT compatible with nested sidebars (untested and not supported). It targets the common single-level section structure generated by Docsify.

Demo

Add the plugin to any Docsify site and the sidebar will gain chevron toggles next to items that contain sublists.

Installation

You can consume this plugin via a CDN or npm.

CDN (recommended for simplicity)

Add the CSS and JS after Docsify in your index.html:

<!-- Docsify core -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify@4/themes/vue.css" />
<script src="https://cdn.jsdelivr.net/npm/docsify@4"></script>

<!-- Sidebar Collapse plugin -->
<link rel="stylesheet" href="https://unpkg.com/docsify-sidebar-collapse/dist/sidebar-collapse.min.css" />
<script src="https://unpkg.com/docsify-sidebar-collapse/dist/sidebar-collapse.min.js"></script>

<!-- Or via jsDelivr -->
<!--
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-sidebar-collapse/dist/sidebar-collapse.min.css" />
<script src="https://cdn.jsdelivr.net/npm/docsify-sidebar-collapse/dist/sidebar-collapse.min.js"></script>
-->

No further configuration is required. The plugin auto-installs itself by extending window.$docsify.plugins.

npm

Install the package:

npm install docsify-sidebar-collapse
# or
pnpm add docsify-sidebar-collapse
# or
yarn add docsify-sidebar-collapse

Then include the built assets in your index.html (recommended), or serve them from your build pipeline:

<link rel="stylesheet" href="/node_modules/docsify-sidebar-collapse/dist/sidebar-collapse.min.css" />
<script src="/node_modules/docsify-sidebar-collapse/dist/sidebar-collapse.min.js"></script>

If your hosting setup disallows serving from node_modules, copy the files from dist/ into your static assets directory during your build/deploy step.

Usage

Once included, the plugin:

  • Adds a chevron toggle before sidebar items that have child lists
  • Collapses sections by default; click to expand
  • Remembers your choices per section in localStorage

There is no runtime configuration required.

Compatibility

  • Docsify: >= 4
  • Themes: Works with default themes and with docsify-themable. If your theme customizes the sidebar heavily, ensure the plugin CSS (sidebar-collapse.css) is loaded to provide the necessary layout and transitions.
  • Nested sidebars: Not supported (untested). This plugin targets a single level of nesting under each top-level list item.

Known limitations

  • The plugin does not currently auto-expand parent sections for active links. It preserves your last collapsed/expanded state instead.

Development

Project layout:

  • src/sidebar-collapse.js – the plugin logic
  • src/sidebar-collapse.css – the styles for the toggles and animations
  • dist/ – built, minified assets generated by the build

Scripts:

npm install
npm run build

This will produce:

  • dist/sidebar-collapse.js (copy of source)
  • dist/sidebar-collapse.min.js (minified)
  • dist/sidebar-collapse.css (copy of source)
  • dist/sidebar-collapse.min.css (minified)

The package is configured to build automatically on npm publish.

License

MIT

Acknowledgements