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

markdown-it-mermaid-enhanced

v0.4.1

Published

markdown-it plugin for Mermaid diagrams with runtime toolbar, theming, and export support

Readme

markdown-it-mermaid-enhanced

[!WARNING] Powered by AI and reviewed by humans

markdown-it-mermaid-enhanced is a markdown-it plugin for rendering Mermaid fences into runtime-friendly wrappers with toolbar actions, browser rendering, export support, and optional VitePress integration

Documentation | Playground

Install

Use the Mermaid runtime

bun install markdown-it markdown-it-mermaid-enhanced mermaid

Use the Excalidraw render engine

bun install markdown-it markdown-it-mermaid-enhanced mermaid @excalidraw/excalidraw @excalidraw/mermaid-to-excalidraw

Use with markdown-it

import MarkdownIt from 'markdown-it'
import markdownItMermaidEnhanced from 'markdown-it-mermaid-enhanced'

const md = new MarkdownIt().use(markdownItMermaidEnhanced, {
  theme: 'auto',
  renderEngine: 'mermaidjs',
})

const html = md.render(`
\`\`\`mermaid
flowchart LR
  A[Build] --> B[Deploy]
\`\`\`
`)

Use in the browser

import 'markdown-it-mermaid-enhanced/styles.css'
import { initMermaidIt } from 'markdown-it-mermaid-enhanced/runtime'

await initMermaidIt()

If you update existing wrappers in place, rerender them like this

import { rerenderMermaidIt } from 'markdown-it-mermaid-enhanced/runtime'

await rerenderMermaidIt()

Use in VitePress

Register the markdown-it plugin

// .vitepress/config.ts
import { defineConfig } from 'vitepress'
import markdownItMermaidEnhanced from 'markdown-it-mermaid-enhanced'

export default defineConfig({
  markdown: {
    config: (md) => {
      md.use(markdownItMermaidEnhanced, {
        theme: 'auto',
        renderEngine: 'mermaidjs',
      })
    },
  },
})

Load the stylesheet and VitePress runtime plugin

// .vitepress/theme/index.ts
import type { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import 'markdown-it-mermaid-enhanced/styles.css'
import mermaidPlugin from 'markdown-it-mermaid-enhanced/vitepress'

export default {
  extends: DefaultTheme,
  enhanceApp(ctx) {
    mermaidPlugin(ctx, {
      waitFor: 'animation-frame',
    })
  },
} satisfies Theme

Font usage

Load fonts in the host page or app, then pass only the family name to the plugin

@import url('https://fonts.googleapis.com/css2?family=Allura&family=Architects+Daughter&family=Amatic+SC:wght@400;700&family=Caveat:wght@400;700&family=Comic+Relief&family=Covered+By+Your+Grace&family=Dancing+Script:wght@400;700&family=Great+Vibes&family=Indie+Flower&family=Just+Another+Hand&family=Kristi&family=Nanum+Pen+Script&family=Patrick+Hand&family=Playball&family=Shadows+Into+Light&display=swap');
@import url('https://cdn.jsdelivr.net/npm/[email protected]/lxgwwenkailite-regular.css');
@import url('https://cdn.jsdelivr.net/npm/[email protected]/font.min.css');
@import url('https://unpkg.com/@chinese-fonts/[email protected]/dist/Xiaolai/result.css');

@font-face {
  font-family: 'Excalifont';
  src: url('https://plus.excalidraw.com/_next/static/media/Excalifont-s.p.436754fa.woff2')
    format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Virgil';
  src: url('https://plus.excalidraw.com/virgil/Virgil.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
const md = new MarkdownIt().use(markdownItMermaidEnhanced, {
  theme: 'auto',
  sketch: true,
  sketchFont: '"Excalifont"',
  fontFamily: '"Excalifont"',
})

The package no longer manages font files or font-face source arrays, so the same host-side loading pattern also applies when you use fontFamily for non-sketch Mermaid text

The playground follows the same pattern and ships ready-to-switch single-family presets for the popular handwritten families listed in the font guide

If you need bilingual handwritten output, pass a manual fallback chain such as "Excalifont", "Xiaolai SC"; Mermaid.js will use it directly, while Excalidraw exports reuse the stack on the SVG text layer without recomputing node sizes