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

@rongyan/mermaid-plus-cli

v0.2.1

Published

Convert mermaid diagrams in markdown to beautiful PNG or SVG using beautiful-mermaid and system Chrome

Downloads

406

Readme

@rongyan/mermaid-plus-cli

Convert mermaid diagrams in markdown or .mmd files to beautiful PNG or SVG images.

Built on top of beautiful-mermaid for high-quality SVG rendering, with PNG export via your system Chrome — zero bundled browsers, zero heavy dependencies.

Compared to mermaid-cli — more beautiful output, uses system Chrome instead of bundling Chromium (~300 MB)

Compared to beautiful-mermaid — adds PNG export and a ready-to-use CLI on top

How PNG works: Chrome is launched headlessly via native Chrome DevTools Protocol (CDP) using Node.js 22+ built-in WebSocket and fetch — no puppeteer, no extra npm dependencies.


Requirements

  • Node.js ≥ 22 (built-in WebSocket required for CDP)
  • Google Chrome ≥ 112 installed on your system (for PNG export only)
    • macOS: /Applications/Google Chrome.app — auto-detected
    • Windows: C:\Program Files\Google\Chrome\Application\chrome.exe — auto-detected
    • Linux: /usr/bin/google-chrome or /usr/bin/chromium — auto-detected
    • Custom path: --chrome /path/to/chrome
  • SVG export does not require Chrome

Installation

npm install -g @rongyan/mermaid-plus-cli

Or use without installing:

npx @rongyan/mermaid-plus-cli article.md

Usage

CLI

# Markdown mode — convert all mermaid blocks to images, update file in-place
mmdpc article.md [assets-dir]

# Single diagram mode — .mmd or .mermaid file
mmdpc diagram.mmd                         # → diagram.png
mmdpc diagram.mmd -o diagram.svg          # SVG (no Chrome needed)
mmdpc diagram.mmd --format svg            # same

# With options
mmdpc article.md ./assets --theme github-dark --scale 3

npx

npx @rongyan/mermaid-plus-cli article.md ./assets --theme nord

Programmatic API

import { convertMarkdown, convertMermaid, THEMES } from '@rongyan/mermaid-plus-cli'

// Convert all mermaid blocks in a markdown file → PNGs, updates file in-place
await convertMarkdown('article.md', './assets', {
  theme: 'github-dark',
  scale: 2,
})

// Convert a single mermaid code string → PNG
await convertMermaid('flowchart LR\n  A --> B --> C', 'diagram.png', {
  theme: 'nord',
  width: 800,
})

// SVG output — no Chrome required
await convertMermaid('flowchart LR\n  A --> B', 'diagram.svg', {
  theme: 'catppuccin-mocha',
})

console.log(Object.keys(THEMES)) // list all 15 theme names

Options

| Flag | Default | Description | |------|---------|-------------| | -i, --input <file> | — | Input file (.md or .mmd) | | -o, --output <file> | auto | Output file path (single-diagram mode) | | -a, --assets <dir> | assets | Image output directory (markdown mode) | | -f, --format <fmt> | png | Output format: png or svg | | --theme <name> | github-light | Named theme (see list below) | | --bg <color> | — | Background color override, e.g. "#ffffff" | | --fg <color> | — | Foreground / text color override | | --font <family> | — | Font family override (Google Fonts or local) | | --transparent | — | Transparent background | | --line <color> | — | Line / edge color override | | --accent <color> | — | Accent / highlight color override | | --muted <color> | — | Muted / secondary text color override | | --surface <color> | — | Node surface / fill color override | | --border <color> | — | Node border color override | | --padding <n> | — | Internal node padding in pixels | | --node-spacing <n> | — | Horizontal node spacing in pixels | | --layer-spacing <n> | — | Vertical layer spacing in pixels | | --width <n> | 1200 | Render width in pixels | | --scale <n> | 2 | Device pixel ratio (2 = Retina) | | --chrome <path> | auto | Path to Chrome ≥ 112 executable | | --font-timeout <ms> | 8000 | Max wait for web fonts to load |

Color and layout flags override the selected --theme.


Themes

15 built-in themes from beautiful-mermaid:

| | | |:---:|:---:| | github-light | github-dark | | nord | nord-light | | tokyo-night | tokyo-night-storm | | tokyo-night-light | catppuccin-mocha | | catppuccin-latte | dracula | | one-dark | solarized-dark | | solarized-light | zinc-light | | zinc-dark | |


Credits

PNG export is powered by Chrome's native DevTools Protocol (CDP) — the same protocol used by chrome-devtools-mcp. SVG rendering is powered by beautiful-mermaid.


License

MIT