https://github.com/kermanx/node-mermaid-render
Render Mermaid charts in Node.js environment.
https://github.com/kermanx/node-mermaid-render
mermaid nodejs
Last synced: about 1 month ago
JSON representation
Render Mermaid charts in Node.js environment.
- Host: GitHub
- URL: https://github.com/kermanx/node-mermaid-render
- Owner: kermanx
- License: mit
- Created: 2023-05-20T01:19:25.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-07-11T01:16:53.000Z (almost 3 years ago)
- Last Synced: 2025-09-15T02:25:58.991Z (9 months ago)
- Topics: mermaid, nodejs
- Language: TypeScript
- Homepage:
- Size: 915 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-mermaid-render
Render Mermaid charts in Node.js environment.
Also can be seen as a simplified version of [mermaid-cli](https://github.com/mermaid-js/mermaid-cli/) with better API support.
Most of its core code is from [mermaid-cli](https://github.com/mermaid-js/mermaid-cli/).
## Install
```bash
npm install node-mermaid-render
```
## Usage
```typescript
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();
})();
```