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

gitbook-plugin-forkmegit

v1.0.4

Published

Display a 'Fork me on Gitcode' ribbon in your GitBook with customizable colors and responsive design

Downloads

18

Readme

GitBook Fork Me Plugin

在您的 GitBook 中显示一个连接到 GitCode 存储库的「Fork me」丝带,支持自定义颜色和响应式设计。

NPM version License Downloads

功能特色

  • 🎨 多种颜色选择:支持 5 种不同颜色的丝带
  • 📱 响应式设计:桌面版显示丝带,移动版显示工具栏按钮
  • ⚙️ 简单配置:只需在 book.json 中配置 URL 和颜色
  • 🔗 安全链接:使用 target="_blank"rel="noopener noreferrer" 确保安全性
  • 🛡️ 错误处理:包含完整的配置验证和错误提示

预览效果

桌面版(长页面宽度)

ribbon with long width

移动版(短页面宽度)

button with short width

安装

npm install gitbook-plugin-forkmegit

使用方法

在您的 book.json 文件中添加以下配置:

{
  "plugins": ["forkmegit"],
  "pluginsConfig": {
    "forkmegit": {
      "url": "https://gitcode.com/your-username/your-repo",
      "color": "gray"
    }
  }
}

配置选项

| 选项 | 类型 | 必需 | 默认值 | 描述 | |------|------|------|--------|------| | url | string | ✅ | - | 您的 GitCode 存储库 URL | | color | string | ❌ | gray | 丝带颜色 |

支持的颜色

  • gray - 灰色(默认)
  • darkblue - 深蓝色
  • red - 红色
  • orange - 橙色
  • green - 绿色

使用案例

案例 1:开源项目文档

{
  "plugins": ["forkmegit"],
  "pluginsConfig": {
    "forkmegit": {
      "url": "https://gitcode.com/nutpi/awesome-project",
      "color": "green"
    }
  }
}

适用场景:开源项目的技术文档,鼓励社区参与和贡献。

案例 2:企业内部项目

{
  "plugins": ["forkmegit"],
  "pluginsConfig": {
    "forkmegit": {
      "url": "https://gitcode.com/company/internal-tool",
      "color": "darkblue"
    }
  }
}

适用场景:企业内部工具的文档,方便团队成员访问源代码。

案例 3:教学项目

{
  "plugins": ["forkmegit"],
  "pluginsConfig": {
    "forkmegit": {
      "url": "https://gitcode.com/teacher/course-examples",
      "color": "orange"
    }
  }
}

适用场景:编程课程的示例代码文档,学生可以轻松获取完整代码。

案例 4:API 文档

{
  "plugins": ["forkmegit"],
  "pluginsConfig": {
    "forkmegit": {
      "url": "https://gitcode.com/developer/api-sdk",
      "color": "red"
    }
  }
}

适用场景:API SDK 的文档,开发者可以快速访问和下载 SDK 源代码。

案例 5:多语言项目

{
  "plugins": ["forkmegit"],
  "pluginsConfig": {
    "forkmegit": {
      "url": "https://gitcode.com/org/multilang-project",
      "color": "gray"
    }
  }
}

适用场景:支持多种编程语言的项目文档,使用默认的灰色丝带保持简洁。

响应式行为

  • 桌面版(屏幕宽度 > 800px):在页面右上角显示彩色丝带
  • 移动版(屏幕宽度 ≤ 800px):隐藏丝带,在工具栏右侧显示 GitHub 图标按钮

故障排除

常见问题

  1. 丝带不显示

    • 检查 url 配置是否正确
    • 确认 GitCode 存储库是否公开
  2. 颜色不生效

    • 检查 color 值是否在支持的选项中
    • 确认配置语法是否正确
  3. 移动版按钮不显示

    • 检查工具栏是否正常加载
    • 确认 CSS 文件是否正确加载

调试模式

在浏览器控制台中查看警告信息:

// 检查配置
console.log('Plugin config:', window.gitbook && window.gitbook.plugins);

贡献

欢迎您的贡献!

Fork me on GitHub, and request your fix in this!