@cssnr/vitepress-plugin-contributors

中文文档
0.2.0发布于 2026/04/20GPL-3.0-onlyTypeScriptESM + CJS构建来源已验证近 30 天下载 5503

VitePress Plugin to easily generate, update and display GitHub contributors. Automatically updated on every installation or deployment with custom options.

原始使用文档
文档目录6 节
  1. Install
  2. Usage
  3. Options
  4. Demos
  5. Support
  6. More VitePress Plugins

NPM Version GitHub Release Version NPM Downloads Bundlephobia Size Deployments NPM Deployments Docs Workflow Release Workflow Lint GitHub Last Commit GitHub Repo Size GitHub Top Language GitHub Contributors GitHub Issues GitHub Discussions GitHub Forks GitHub Repo Stars GitHub Org Stars Discord Ko-fi

VitePress Plugin Contributors

VitePress Plugin Contributors

A VitePress Plugin to Easily generate, update and display repository Contributors. Supports GitHub (including Enterprise) and Forgejo (Gitea, Codeberg, etc.).

This package includes two components that can be use together or individually.

  1. get-contributors - script to generate the contributors.json file.
  2. Contributors.vue - component to display the contributors in VitePress.

Also includes a detailed Installation guide with available Support.

View Documentation

Install

View Install Guide

  1. Install directly into your VitePress from npmjs.
npm i @cssnr/vitepress-plugin-contributors
  1. Add the get-contributors script to your package.json.
{
  "scripts": {
    "get-contributors": "npx get-contributors user/repo",
    "postinstall": "npm run get-contributors"
  }
}

If you don't add the postinstall script you need to add get-contributors to your build.

Click Here to View Usage - get-contributors

View Get Contributors Docs

Show help: npx get-contributors -h

Basic usage, all contributors excluding bot users.

npx get-contributors user/repo

Limit to top 20 contributors, specify output file, and include bot users.

npx get-contributors user/repo -m 20 -f .vitepress/contributors.json -b

Only the user/repo is required. All other arguments are optional.

Argument FlagDefault ValueDescription of the Argument
-f/--file.vitepress/contributors.jsonOutput file relative to project root
-m/--max-users0Max users to fetch, 0 is unlimited
-b/--bots-Include bot users in the results
-e/--error-Throw errors during generation
-k/--keyslogin,avatar_urlContributor keys to save to file
-G/--githubhttps://api.github.comGitHub API URL (for Enterprise)
-F/--forgejo-Forgejo API URL (for Gitea/Codeberg)

Note: This script makes 1 request to the GitHub API for every 100 contributors on the repository (or max-users). Because of this if you have a lot of contributors (200+) running this back-to-back may hit the GitHub rate limit for unauthenticated requests, which is 60 requests per hour. If this occurs the script will generate a partial or empty contributors so development can continue.

This does not affect GitHub Action runs which are authenticated with the GTIHUB_TOKEN.


  1. Add the contributors.json file location to your .gitignore.
.vitepress/contributors.json
  1. Generate the contributors.json file.
npm run get-contributors

Alternatively, if you did not add the get-contributors script from step #2.

npx get-contributors user/repo
  1. Import the components in your .vitepress/theme/index.js.
import DefaultTheme, { VPBadge } from 'vitepress/theme' // only if using VPBadge

import Contributors from '@cssnr/vitepress-plugin-contributors' // ADD this line
import '@cssnr/vitepress-plugin-contributors/style.css' // ADD this line

import contributors from '../contributors.json' // OPTIONAL - Global

export default {
  ...DefaultTheme,
  enhanceApp({ app }) {
    app.component('Badge', VPBadge) // only if using VPBadge
    app.component('Contributors', Contributors) // ADD this line
    app.config.globalProperties.$contributors = contributors // OPTIONAL - Global
  },
}

Global - If you are unsure about this usage, add these lines for simplicity.

VPBadge - Only required if you are using the VitePress Badge.

More Details on the contributors.json path

Note, you may need to modify the ../contributors.json import location to match your setup. If your VitePress configuration directory is located at .vitepress then the default output path of .vitepress/contributors.json will import from the relative path ../contributors.json.

If you are not importing contributors as a Global, this path will be relative to the file you are importing it in.
See the Usage for more details.


  1. Finally, use the Contributors.vue component in your markdown or component.
<Contributors :contributors="$contributors" />

See the Usage for more details...

Usage

View Usage Guide

To use, simply add the <Contributors> tag to your markdown file (or component).

If you added contributors as a global component, you only need the <Contributors> tag.

<Contributors :contributors="$contributors" />

Otherwise, import the contributors.json and add a <Contributors> tag.

<script setup>
import contributors from '../.vitepress/contributors.json'
</script>

<Contributors :contributors="contributors" />

The contributors.json file is relative to the file you are importing it in.

See the Options for more details...

Options

View Contributors Docs

Only the :contributors parameter is required, everything else is optional.

ParameterDefaultTypeDescription of the Parameter
:contributorsRequiredArraycontributors.json file import data
max-users-StringMax Number of users to display
heading-StringOptional Heading text
size64StringSize of Icons in pixels
margin-StringCSS margin string for container

Example with all arguments.

<Contributors
    :contributors="$contributors"
    heading="VitePress Contributors"
    max-users="98"
    size="48"
    margin="36px 0 96px"
/>

VitePress Contributors

Demos

The plugin is running on these pages:

If you have a live demo, let us know and we will post it here...

Support

Logs can be found inspecting the page (Ctrl+Shift+I), clicking on the Console, and; Firefox: toggling Debug logs, Chrome: toggling Verbose from levels dropdown.

If you run into any issues or need help getting started, please do one of the following:

Features Issues Discussions Discord

More VitePress Plugins

Contributing

All contributions are welcome including bug reports, feature requests, or pull requests.

For instructions on creating a PR for the Package or Documentation, see the CONTRIBUTING.md.

Please consider making a donation to support the development of this project and additional open source projects.

Ko-fi

For a full list of current projects visit: https://cssnr.github.io/

Star History Chart

版本与发布记录

@cssnr/vitepress-plugin-contributors 共发布 7 个版本,首次发布于 2025/09/13;过去 12 个月发布了 2 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.2.0latest2026/04/206 个月前
0.1.02026/04/146 个月前
0.0.52025/10/311 年前
0.0.42025/09/241.1 年前
0.0.32025/09/141.2 年前
0.0.22025/09/131.2 年前

关于 @cssnr/vitepress-plugin-contributors 的常见问题

@cssnr/vitepress-plugin-contributors 是什么?

VitePress Plugin to easily generate, update and display GitHub contributors. Automatically updated on every installation or deployment with custom options.

如何安装 @cssnr/vitepress-plugin-contributors?

在项目目录运行 npm install @cssnr/vitepress-plugin-contributors,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 get-contributors,可以用 npx get-contributors 直接运行。

@cssnr/vitepress-plugin-contributors 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cssnr/vitepress-plugin-contributors 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@cssnr/vitepress-plugin-contributors 可以商用吗?

@cssnr/vitepress-plugin-contributors 使用 GPL-3.0-only 许可。强 Copyleft:分发包含该代码的软件时,整个作品需以 GPL-3.0 兼容许可开源,并附带专利与反锁定条款。仅内部使用不触发此义务。以上为概括,不构成法律意见,请以许可原文为准。

@cssnr/vitepress-plugin-contributors 的下载量有多少?

根据 npm 官方下载统计,@cssnr/vitepress-plugin-contributors 在 2026/10/11 – 2026/11/09 这 30 天内被下载 5,503 次,日均约 183 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cssnr/vitepress-plugin-contributors 还在维护吗?

最新版本 0.2.0 发布于 2026/04/20(6 个月前);至今共发布 7 个版本,其中过去 12 个月发布了 2 个;首次发布于 2025/09/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。