New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

node-mermaid-render

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-mermaid-render

Render Mermaid charts in Node.js environment.


Version published
Maintainers
1
Created

node-mermaid-render

Render Mermaid charts in Node.js environment.

Also can be seen as a simplified version of mermaid-cli with better API support.

Most of its core code is from mermaid-cli.

Install

npm install node-mermaid-render

Usage

import { NodeMermaidRender } from "node-mermaid-render";

const mermaidRender = new NodeMermaidRender();

(async () => {
  // Initialize mermaid render.
  // If don't call this method, it will be called automatically when calling rendering method.
  // Remember to call it with `await` keyword.
  await mermaidRender.initialize();

  const svg = await mermaidRender.renderToSVG(`
    graph TD;
      A-->B;
      A-->C;
      B-->D;
      C-->D;
  `).data.toString();
})();

FAQs

Package last updated on 11 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts