Mermaid Diagram Actor avatar
Mermaid Diagram Actor

Pricing

from $0.01 / 1,000 results

Go to Apify Store
Mermaid Diagram Actor

Mermaid Diagram Actor

Convert Text description or Mermaid code to PNG, SVG, or PDF images. Flowcharts, sequence diagrams, Gantt charts, ER diagrams and more.

Pricing

from $0.01 / 1,000 results

Rating

0.0

(0)

Developer

Lorenzo De Martinis

Lorenzo De Martinis

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

28 minutes ago

Last modified

Share

Mermaid Diagram Generator

Transform ideas into professional diagrams in seconds. No design skills needed.

Features

Three Modes

  • AI Mode - Describe in plain English, AI generates the diagram
  • Code Mode - Paste Mermaid syntax for full control
  • Batch Mode - Generate multiple diagrams with individual settings

Output Options

  • PNG, SVG, PDF formats
  • 5 visual themes
  • Custom background colors
  • Adjustable resolution (1-5x)

Quick Start

AI Mode (No coding required)

  1. Select diagram type (e.g., "Flowchart")
  2. Describe what you want in plain English
  3. Add your OpenAI API key
  4. Click Start
{
"aiDiagramType": "flowchart",
"aiDescription": "User login: validate credentials, if valid show dashboard, otherwise show error",
"openaiApiKey": "sk-...",
"outputFormat": "png"
}

Code Mode (Mermaid Syntax)

{
"mermaidCode": "sequenceDiagram\n User->>API: Login\n API->>DB: Validate\n DB-->>API: OK\n API-->>User: Token",
"outputFormat": "svg"
}

Tip: Use Form view (not JSON) to paste multiline Mermaid code directly.

Supported Diagram Types

TypeValueExample Description
Flowchartflowchart"Login flow: if valid show dashboard, otherwise show error"
Sequence Diagramsequence"User calls API, API queries database, returns response"
ER Diagramer"Users have many orders, orders contain products"
Gantt Chartgantt"Project: design Jan 1-15, development Jan 16-31"
Pie Chartpie"Sales: Electronics 40%, Clothing 35%, Food 25%"
State Diagramstate"Order states: pending, processing, shipped, delivered"
Class Diagramclass"Animal parent of Dog and Cat, Dog has name and age"
Mindmapmindmap"Web Development: Frontend (React, Vue), Backend (Node)"
Timelinetimeline"Company: 2020 founded, 2021 Series A, 2023 IPO"
Quadrant Chartquadrant"Priority matrix: urgent+important quadrants"
Git Graphgitgraph"Main branch, feature branch, merge back"
Sankey Diagramsankey"Budget flow: Revenue to Costs to Operations"
XY Chartxy"Monthly sales: Jan 100, Feb 150, Mar 200"

Input Parameters

ParameterTypeRequiredDescription
mermaidCodestringNo*Mermaid diagram syntax (Code Mode)
aiDiagramTypeenumNo*Diagram type for AI Mode
aiDescriptionstringNo*Plain English description (AI Mode)
openaiApiKeystringAI ModeYour OpenAI API key
outputFormatenumNopng (default), svg, pdf
themeenumNodefault, forest, dark, neutral, base
backgroundColorstringNoCSS color (default: white)
scaleintegerNoQuality 1-5 (default: 3)
maxWidthintegerNoMax width in pixels (all formats)
maxHeightintegerNoMax height in pixels (all formats)
diagramsarrayNoBatch mode: [{code, name, theme?, outputFormat?, ...}]

Output

Each diagram produces:

Image file in Key-Value Store with direct download URL

Metadata in Dataset:

{
"success": true,
"diagramName": "diagram",
"diagramType": "flowchart",
"url": "https://api.apify.com/v2/key-value-stores/.../records/diagram.png",
"generatedWithAi": true,
"mermaidCode": "flowchart TD\n ..."
}

Integration Examples

Themes

ThemeDescription
defaultBlue tones (professional)
forestGreen tones (nature)
darkDark background
neutralGray tones (minimal)
baseNo styling

Pricing

$0.005 per diagram (any mode)

Platform compute: ~$0.01 per run

AI Mode requires your own OpenAI API key (~$0.001 per diagram).

FAQ

What's the difference between AI Mode and Code Mode?

AI Mode lets you describe diagrams in plain English - no syntax knowledge needed. Code Mode requires Mermaid syntax but gives you full control over the diagram structure.


What happens if I fill multiple input fields?

The Actor follows this priority:

  1. Batch Mode (diagrams array) - if filled, ignores everything else
  2. AI Mode (aiDiagramType + aiDescription) - if both filled, ignores mermaidCode
  3. Code Mode (mermaidCode) - used only if batch and AI mode are empty

You cannot combine modes in a single run. Choose one.


Can I use different settings per diagram in Batch Mode?

Yes! Each diagram in the batch can have its own settings. If not specified, global settings are used as fallback.

[
{"code": "flowchart TD\n A-->B", "name": "light", "theme": "default", "outputFormat": "png"},
{"code": "flowchart TD\n C-->D", "name": "dark", "theme": "dark", "backgroundColor": "#1a1a1a", "outputFormat": "svg"}
]

Available per-diagram settings: outputFormat, theme, backgroundColor, scale, maxWidth, maxHeight.


How do I enter Batch Mode in the Form view?

The "Batch Mode" field requires valid JSON array format:

[
{"code": "flowchart TD\n A-->B", "name": "diagram1"},
{"code": "pie title X\n \"A\": 50", "name": "diagram2"}
]

For easier input, use the JSON tab instead of Form view.


Do maxWidth/maxHeight work with all formats?

Yes! maxWidth/maxHeight work with all formats:

  • PNG: Resized with padding to exact dimensions
  • SVG: Width/height attributes modified, maintains aspect ratio
  • PDF: Page scaled, maintains aspect ratio

Note: scale only affects PNG (pixel density). SVG and PDF are vector formats.


How do I get a transparent background?

Set backgroundColor to transparent. Works best with PNG format. Some diagram elements may still have their own background colors based on the theme.


What's the maximum diagram complexity?

No hard limit. Complex diagrams may take up to 2 minutes to render.


Can I customize colors beyond themes?

Use backgroundColor for diagram background. For more control, use Code Mode with Mermaid styling directives in your code.

Resources

Support

Questions? Contact via Apify Store