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

@aaron212/astro-pele

v0.1.2

Published

Render Mermaid diagrams with Pele in Astro and Sätteri.

Readme

@aaron212/astro-pele

Render Mermaid diagrams with Pele, Obsidian's Mermaid renderer, in Astro and Sätteri. Diagrams render in the browser, with diagram types loaded on demand. Browser JavaScript is required.

See the demo site.

Astro component

Install the package with pnpm add @aaron212/astro-pele, then import the component in an .astro file:

---
import Mermaid from "@aaron212/astro-pele/components/Mermaid.astro";
---

<Mermaid
  code={`flowchart LR
  A[Write Mermaid] --> B[Render with Pele]`}
  fontSize={18}
/>

You can also pass source through the default slot:

<Mermaid>{`sequenceDiagram
  Alice->>Bob: Hello!`}</Mermaid>

The code prop takes precedence over the slot, including when empty. Slot text is HTML-decoded before rendering; prefer a string expression for Mermaid syntax containing arrows, angle brackets, or braces.

The component accepts the JSON-serializable Pele mount options in Styling and Config as props and an optional class for its .astro-pele container. Component props override integration options for that diagram. No integration or Sätteri processor is required. The component bundles the browser mounting runtime automatically, including responsive layout, zoom controls, and cleanup during Astro client navigation.

Astro markdown

Astro 7 uses Sätteri by default, so no separate processor installation or configuration is needed. Install the package in your Astro project:

pnpm add @aaron212/astro-pele

Configure astro.config.ts:

import pele from "@aaron212/astro-pele";
import { defineConfig } from "astro/config";

export default defineConfig({
  integrations: [pele()],
});

Write Mermaid fenced code blocks in Markdown:

```mermaid
flowchart LR
  A[Write Markdown] --> B[Render with Pele]
```

The integration preserves existing Sätteri options and plugins, bypasses syntax highlighting for Mermaid fences, and bundles the browser renderer automatically. Other code blocks keep their usual highlighting. MDX uses the same plugins when it inherits Astro's Markdown processor.

Diagrams mount on initial page load and after Astro client navigation. Before a page swap, the integration destroys each mount to release its observers and event listeners, and cancels pending mounts before they render. Invalid diagrams display Pele's built-in error message; loading failures display a short error message.

Pele supports a subset of Mermaid; see its compatibility documentation.

Standalone Satteri

Install the integration and Sätteri directly when using its API without Astro:

pnpm add @aaron212/astro-pele satteri

The /satteri entry point prepares diagram containers without Astro:

import { peleMdast } from "@aaron212/astro-pele/satteri";
import { markdownToHtml } from "satteri";

const { html } = markdownToHtml("```mermaid\nflowchart LR\n  A --> B\n```", {
  mdastPlugins: [peleMdast()],
});

peleMdast() keeps Mermaid source in a data attribute on a blank placeholder, outside syntax highlighting. Include the returned HTML in your page, then bundle this client code with your application's browser entry point:

import { mountPele } from "@aaron212/astro-pele/client";

const cleanup = mountPele(document, { zoom: false });

// Before removing the diagrams or navigating away in a client-side application:
// cleanup();

mountPele(root?, options?) mounts uninitialized .astro-pele[data-pele] descendants and returns a cleanup function. It accepts Pele's MountOptions, including zoom, onRender, onError, and sanitize. Call it after the HTML has been inserted into the document. The cleanup function is available immediately, even while diagram types are loading. Cleanup cancels pending mounts, destroys completed mounts, and restores blank placeholders.

Styling and Config

Pass Pele's rendering and mount options to the integration:

pele({
  zoom: { controls: false, maxScale: 4 },
  autoDirection: false,
  fontSize: 18,
  config: {
    flowchart: { curve: "linear" },
  },
});

Options apply to all diagrams, including after client navigation. Calling pele() keeps Pele's defaults. The package exports the PeleOptions type. See Pele's API documentation for available options and defaults.

Integration options must be JSON-serializable; config accepts JSON values, and now accepts a Unix timestamp in milliseconds. Function options (measurer, icons, onRender, onError, and sanitize) are available through the standalone client API above.

Pele reads fonts from its container and supports CSS variables for theme colors. For example:

.astro-pele {
  --pele-bg: var(--background);
  --pele-fg: var(--foreground);
  --pele-font: var(--font-body);
}

Use your site's own variable names. See Pele's theming documentation for the full list.

The browser integration's placeholder has no reserved height; Pele determines the height when it renders. Without JavaScript, that container remains blank. This applies to both the Astro component and Markdown diagrams.

Development

mise install
mise exec -- pnpm install
mise exec -- pnpm format
mise exec -- pnpm lint
mise exec -- pnpm check
mise exec -- pnpm build

pnpm build emits JavaScript and type declarations into dist/.

To run the demo:

cd demo
pnpm install --frozen-lockfile
pnpm dev

The demo's install hook also installs the parent package's dependencies, including its build tools, from the root lockfile. CI can use demo/ as its root directory with pnpm install --frozen-lockfile as the install command and pnpm build as the build command. The demo builds the parent package before starting Astro.