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

rspress-plugin-giscus

v1.0.4

Published

Rspress plugin to add Giscus comments

Readme

rspress-plugin-giscus

Rspress 插件:在每页文章下方集成 Giscus 评论。

安装

pnpm add rspress-plugin-giscus
# 或本地链接
# "rspress-plugin-code-giscus": "file:../path/to/rspress-plugin-giscus"

配置

rspress.config.ts 中添加插件即可,评论默认会出现在正文页 Footer 之前(beforeDocFooter 位置):

import { defineConfig } from 'rspress/config';
import { pluginGiscus } from 'rspress-plugin-giscus'; // 或 rspress-plugin-code-giscus

export default defineConfig({
  plugins: [
    pluginGiscus({
      repo: '你的用户名/仓库名',
      repoId: 'R_kgDO...',
      category: 'Announcements',
      categoryId: 'DIC_kwDO...',
    }),
  ],
});

使用方法

默认:beforeDocFooter

使用插件后,评论会自动插入到每页正文的「DocFooter 之前」,无需自定义 Layout。

自定义 Layout 中手动放置

若需自己控制位置,可导入 Giscus 组件,在自定义主题的 Layout 里使用 beforeDocFooter 等插槽:

import { BasicLayout } from '@rspress/core/theme';
import { Giscus } from 'rspress-plugin-giscus';

const Layout = () => (
  <BasicLayout
    beforeDocFooter={
      <Giscus
        repo="你的用户名/仓库名"
        repoId="R_kgDO..."
        category="Announcements"
        categoryId="DIC_kwDO..."
      />
    }
  />
);

export default Layout;

Giscus 的配置与 Giscus 文档 一致。

开发

本地开发

  1. 克隆仓库
  2. 安装依赖:npm install
  3. 在测试项目中使用相对路径引入插件

构建

这是一个TypeScript项目,无需额外构建步骤。

故障排除

useThemeState is not a function or its return value is not iterable

该报错出现在 Rspress 默认主题的 ClientApp 中,通常与 @theme 别名或多份 @rspress/core 有关,可按下面步骤处理:

  1. 统一 @rspress/core 版本(推荐先做)
    在主项目根目录的 package.json 里增加 overrides,保证只存在一份 @rspress/core

    {
      "pnpm": {
        "overrides": {
          "@rspress/core": "^2.0.0"
        }
      }
    }

    使用 npm 时:

    {
      "overrides": {
        "@rspress/core": "^2.0.0"
      }
    }

    然后删除 node_modules 和锁文件,重新安装依赖。

  2. 若使用了自定义主题目录(themeDir
    确保自定义主题的入口(如 index.js)把 useThemeState 从默认主题里再导出,例如:

    export { useThemeState } from '@theme-original';
    // 或
    export { useThemeState } from '@rspress/core/theme';

    否则 ClientAppimport { useThemeState } from '@theme' 会拿不到该函数,从而报错。

  3. 确认是否由本插件引起
    暂时从 rspress.config.ts 中移除本插件,重新构建并运行。若错误消失,再按 1、2 步检查依赖与主题导出后重新启用插件。

许可证

MIT License