Skip to main content
Home

Built and signed on GitHub Actions

A Mermaid diagram to image library.

This package works with Node.js, Deno, Bun
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
100%
Published
a month ago (0.2.0)

A Mermaid diagram to image library.

Usage

Use the generate() function to convert Mermaid diagram markdown to an SVG:

import { generate } from "@kitsonk/mdd2img";

const mdd = `graph TD; A-->B;`;

const svg = await generate(mdd);
await Deno.writeTextFile("output.svg", svg);

About

This library was inspired by Mermaid.ink and meant as a easy way to render Mermaid diagrams. While there has been an effort to "server side" render Mermaid diagrams, there is a huge amount of complexity as Mermaid diagrams leverage such a wide spectrum of the web platform that would have to be replicated in a pure server side limitation. All current solutions, including Mermaid.ink and the Mermaid CLI use some form of headless browser to actually render the diagrams.

This library uses Astral library to procedurally control a browser to render the diagram and return the resulting image.

Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@kitsonk/mdd2img

Import symbol

import * as mdd_img from "@kitsonk/mdd2img";
or

Import directly with a jsr specifier

import * as mdd_img from "jsr:@kitsonk/mdd2img";

Add Package

pnpm i jsr:@kitsonk/mdd2img
or (using pnpm 10.8 or older)
pnpm dlx jsr add @kitsonk/mdd2img

Import symbol

import * as mdd_img from "@kitsonk/mdd2img";

Add Package

yarn add jsr:@kitsonk/mdd2img
or (using Yarn 4.8 or older)
yarn dlx jsr add @kitsonk/mdd2img

Import symbol

import * as mdd_img from "@kitsonk/mdd2img";

Add Package

vlt install jsr:@kitsonk/mdd2img

Import symbol

import * as mdd_img from "@kitsonk/mdd2img";

Add Package

npx jsr add @kitsonk/mdd2img

Import symbol

import * as mdd_img from "@kitsonk/mdd2img";

Add Package

bunx jsr add @kitsonk/mdd2img

Import symbol

import * as mdd_img from "@kitsonk/mdd2img";