All Plugins
Mermaid
DiagramsGenerate diagrams from text using Mermaid syntax. Create flowcharts, sequence diagrams, class diagrams, and more.
Installation
npm install @teamflojo/floimg-mermaid Quick Start
import createClient from "@teamflojo/floimg";
import mermaid from "@teamflojo/floimg-mermaid";
const floimg = createClient();
floimg.registerGenerator(mermaid());
const diagram = await floimg.generate({
generator: "mermaid",
params: {
definition: `
flowchart TD
A[User Request] --> B{Auth Check}
B -->|Valid| C[Process]
B -->|Invalid| D[401 Error]
C --> E[Response]
`
}
});
await floimg.save(diagram, "./architecture.png"); API Reference
| Parameter | Type | Required | Description |
|---|---|---|---|
definition | string | Yes | Mermaid diagram definition |
theme | "default" | "dark" | "forest" | "neutral" | No | Mermaid theme (default: default) |
backgroundColor | string | No | Background color (default: transparent) |
width | number | No | Image width in pixels |
Examples
API Flowchart
Request processing flowchart
await floimg.generate({
generator: "mermaid",
params: {
definition: `
flowchart TD
A[Request] --> B{Validate}
B -->|OK| C[Process]
B -->|Fail| D[Error]
C --> E[Response]
`
}
});