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

@tooee/mermaid-pele

v0.16.4

Published

Opt-in Mermaid fence renderer for Tooee that draws Pele SVG diagrams as terminal images

Readme

@tooee/mermaid-pele

An opt-in renderer for ```mermaid Markdown fences. It draws each diagram with Pele as an SVG, applies the Tooee theme colours, rasterizes it with resvg, and shows the PNG in the OpenTUI <image> element.

Part of the Tooee monorepo. See the main repo for documentation.

Tooee does not register this renderer by default. MarkdownView and @tooee/view keep the built-in beautiful-mermaid ASCII renderer. Apps that do not import this package do not install Pele or resvg.

Use

import { createPeleMermaidRenderer } from "@tooee/mermaid-pele";
import { launch } from "@tooee/view";

await launch({
  codeBlockRenderers: { mermaid: createPeleMermaidRenderer() },
  contentProvider,
});

The same codeBlockRenderers map works on View and MarkdownView.

Strategies

Each fence goes through a list of renderers. When one cannot draw the fence, the next one runs. The fence source is always the last step.

| strategy | Order | | --------------------------- | ------------------------------------------- | | pele-then-ascii (default) | Pele image, beautiful-mermaid ASCII, source | | ascii-then-pele | beautiful-mermaid ASCII, Pele image, source | | pele-only | Pele image, source |

The Pele step cannot draw a fence when Pele rejects the source, when resvg fails, or when the terminal has no pixel image support.

Options

| Option | Default | Effect | | --- | --- | --- | | strategy | pele-then-ascii | Renderer order, see above. | | protocol | auto | Image protocol for <image>. auto uses kitty or sixel when the terminal reports it. When auto resolves to blocks (no support, or inside tmux), the Pele step is skipped. Pass blocks to draw half-block images anyway. | | maxRows | terminal height minus IMAGE_WINDOW_PADDING_ROWS (6) | Rows one diagram may use before it shrinks to fit. | | zoom | 1.5 (DEFAULT_MERMAID_ZOOM) | Screen pixels per SVG pixel before the diagram shrinks to fit. Pele draws labels at 16 CSS px, so the default draws them at 24 screen px. Pass 1 for the 0.16.1 size. | | scale | the larger of 2 and zoom | Raster pixel density over the SVG size. It changes sharpness, not the drawn size. | | cacheSize | 64 | Diagrams kept in this renderer's cache. | | fonts | detected | { files, sansFamily, monoFamily } for resvg. | | now | current time | Fixed clock for gantt "today" markers. |

Each createPeleMermaidRenderer() call has its own options and its own cache.

Lower-level exports

  • renderPeleDiagram(source, options) and createPeleRenderCache(limit): the Pele, theme, and resvg pipeline. They return { ok: false, stage, code, message } on failure and never throw.
  • peleVariablesFromTheme(theme, font, monoFont) and inlineCssVariables(svg, variables): map a Tooee theme to Pele's --pele-* tokens and inline every var() and color-mix(), because resvg does not support CSS custom properties.
  • imageBoxSize and cellGeometry: size the image box in terminal cells from the SVG size and the cell pixel size.
  • supportsDiagramImages and useDiagramImageSupport: the image support rule above.
  • findRasterFonts and rasterizeSvg.

Known limits

  • Images have no text features. An image block has no copy, search, or horizontal pan. The ASCII renderer has all three.
  • First render cost. Pele layout takes about 0.4 ms and the resvg raster about 18 ms for each diagram (warm median on the Personal vault corpus). The work is synchronous and cached, so a long document with many diagrams pauses once on first render.
  • Fonts. Pele measures labels with Arial metrics. The renderer looks for Liberation Sans, then Arial, then DejaVu Sans. Other fonts can make labels overflow their boxes. When none of these fonts exists, resvg loads every system font, which is slower.
  • Pele is stricter than beautiful-mermaid. Some fences that beautiful-mermaid draws, such as unquoted parentheses in an edge label, are Pele syntax errors. The default strategy draws those with ASCII.
  • Install weight. Pele is about 3.5 MB. @resvg/resvg-js is about 8.5 MB plus a native binary for each platform.