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

hexo-mermaid-diagram

v1.0.0

Published

A Hexo plugin for rendering Mermaid diagrams with iframe-based security

Readme

Hexo Mermaid Diagram Plugin

仿照 GitHub 的实现方式,使用 iframe 渲染 Mermaid 图表

支持以下特性:

  • 放大/缩小图表
  • 上下左右移动
  • 设置主题 (WIP: Dark/light mode support)

Preview

image

安装

npm install hexo-mermaid-diagram --save

使用方法

安装插件后,你可以在 Markdown 文件中直接使用 mermaid 代码块:

​```mermaid
graph TD
    A[Hard] -->|Text| B(Round)
    B --> C{Decision}
    C -->|One| D[Result 1]
    C -->|Two| E[Result 2]
​```

配置

在 Hexo 的 _config.yml 中添加配置:

mermaid_diagram:
  # Mermaid.js 版本
  version: "10.6.1"
  # 主题配置
  theme: "default"
  # 自定义 CSS 类名
  class_name: "mermaid-diagram"

工作原理

本插件参考 GitHub 的实现方案:

  1. HTML 管道过滤器: 扫描渲染后的 HTML,查找带有 mermaid 语言标识的代码块
  2. 渐进式模板: 替换为支持渐进增强的模板,在非 JavaScript 环境中显示原始代码
  3. iframe 注入: 在支持 JavaScript 的环境中,注入指向渲染服务的 iframe
  4. 安全隔离: 用户内容在 iframe 中渲染,与主页面隔离

开发

# 克隆仓库
git clone https://github.com/your-username/hexo-mermaid-diagram.git
cd hexo-mermaid-diagram

# 安装依赖
npm install

# 链接到本地 Hexo 项目进行测试
npm link
cd /path/to/your/hexo/blog
npm link hexo-mermaid-diagram

许可证

MIT