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

vitepress-plugin-collapse

v0.11.1

Published

Render collapsible sections in your VitePress site.

Readme

vitepress-plugin-collapse

Render collapsible sections in your VitePress site.

在 VitePress 中渲染可折叠的内容区块。

Usage

With Vitepress-tuck

Installation:

# npm
npm install -D vitepress-tuck vitepress-plugin-collapse
# pnpm
pnpm add -D vitepress-tuck vitepress-plugin-collapse
# yarn
yarn add -D vitepress-tuck vitepress-plugin-collapse

Configuration:

// .vitepress/config.ts
import collapse from 'vitepress-plugin-collapse'
import { defineConfig } from 'vitepress-tuck'

export default defineConfig({
  plugins: [collapse()],
})

With Vitepress

Installation:

# npm
npm install -D vitepress-plugin-collapse
# pnpm
pnpm add -D vitepress-plugin-collapse
# yarn
yarn add -D vitepress-plugin-collapse

Configuration:

// .vitepress/config.ts
import { defineConfig } from 'vitepress'
import { collapseMarkdownPlugin } from 'vitepress-plugin-collapse'

export default defineConfig({
  markdown: {
    config: (md) => {
      md.use(collapseMarkdownPlugin)
    },
  },
})
// .vitepress/theme/index.ts
import type { Theme } from 'vitepress'
import { enhanceAppWithCollapse } from 'vitepress-plugin-collapse/client'
import DefaultTheme from 'vitepress/theme'

export default {
  extends: DefaultTheme,
  enhanceApp(ctx) {
    enhanceAppWithCollapse(ctx)
  },
} satisfies Theme

Syntax

Use ::: collapse container with a list to create collapsible sections. Each list item becomes a collapse panel: the first line is the title, and the following indented content is the panel body.

使用 ::: collapse 容器配合列表来创建可折叠区块。每个列表项成为一个折叠面板: 第一行为标题,后续缩进内容为面板正文。

Basic

::: collapse
- Title 1
  Content of item 1.

- Title 2
  Content of item 2.
:::

Accordion

Add accordion to enable accordion mode — only one item can be expanded at a time. Use expand to expand the first item by default when no explicit :+ flag is set.

添加 accordion 启用手风琴模式 —— 同时只能展开一项。使用 expand 可在没有 显式 :+ 标记时默认展开第一项。

::: collapse accordion expand
- Question 1
  Answer 1.

- Question 2
  Answer 2.
:::

Card Style

Add card to render the container with a bordered, rounded card style.

添加 card 以带边框、圆角的卡片样式渲染容器。

::: collapse accordion card
- Question 1
  Answer 1.

- Question 2
  Answer 2.
:::

Per-item Expand Flag

Prefix a title with :+ to expand an item, or :- to collapse it. In accordion mode, only the first :+ flag takes effect.

在标题前添加 :+ 展开该项,或 :- 收起该项。手风琴模式下只有第一个 :+ 标记生效。

::: collapse
- :+ Expanded by default
  Content.

- :- Collapsed by default
  Content.

- No flag, follows container `expand` attribute
  Content.
:::

Container Attributes

| Attribute | Type | Description | | ----------- | --------- | ------------------------------------------------------------------------- | | accordion | boolean | Enable accordion mode (only one item expanded at a time) / 启用手风琴模式 | | card | boolean | Render with card style (bordered and rounded) / 使用卡片样式 | | expand | boolean | Default expanded state / 默认展开状态 |

Item Flags

| Flag | Description | | ---- | --------------------------------------------------------------------------------------------------- | | :+ | Expand this item (only the first one wins in accordion mode) / 展开该项(手风琴模式下仅第一个生效) | | :- | Collapse this item / 收起该项 |