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-markdown-mermaid

v0.0.1

Published

A Hexo plugin for rendering Mermaid diagrams

Readme

hexo-markdown-mermaid

Hexo 插件,用于在文章中渲染 Mermaid 图表。

安装

npm install hexo-markdown-mermaid

快速开始

在文章中添加 mermaid 代码块:

```mermaid
graph TD
A-->B
A-->C
B-->D
C-->D
```

配置

使用语法高亮器(推荐)

仅支持 highlight.js。需排除 mermaid 以便 Mermaid.js 渲染:

highlight:
  enable: true
  exclude_languages:
    - mermaid

:::warning PrismJS 不支持,因为没有 exclude_languages 选项。 :::

Mermaid 选项

mermaid:
  version: 11
  startOnLoad: true
  theme: default
  # 其他 mermaid 配置选项...

可用选项

| 选项 | 描述 | 默认值 | |------|------|--------| | version | Mermaid 版本 | 11 | | startOnLoad | 页面加载时自动渲染 | true | | 其他选项 | 参阅 Mermaid 配置 | - |

许可

MIT


技术细节

为什么在浏览器端渲染而非构建时?

Mermaid CLI 可以在构建时预渲染图表,但它依赖较重(需要 Puppeteer 或类似工具),不适合大多数 Hexo 环境。

本插件选择浏览器端渲染,以保持简洁和广泛兼容性。

为什么要排除 mermaid?

使用 highlight.js 且 Hexo 配置 highlight.enable: true 时,代码块会被预渲染为 HTML,每行被包装在 <span class="line"> 中:

<pre><span class="line">graph TD</span>
<span class="line">A--&gt;B</span></pre>

Mermaid.js 查找 class 为 .mermaid 的元素。排除后,代码块会渲染为:

<pre><code class="highlight mermaid">graph TD\nA--&gt;B</code></pre>

这样 Mermaid.js 就能正确找到并渲染图表。

Mermaid 选择器

本插件使用 Mermaid 默认的查询选择器 .mermaid。参阅 Mermaid RunOptions