Render to Binary
AI-generatedOverview
This node operation renders Mermaid diagram code into a binary image or document format. It takes Mermaid code as input and generates a diagram in PNG, SVG, or PDF format, which is then stored as binary data in the workflow. This is useful for automating the creation of visual diagrams from Mermaid syntax within workflows, such as generating flowcharts, sequence diagrams, or other supported Mermaid diagrams for reports, documentation, or presentations.
Use Case Examples
- Generating a flowchart diagram from Mermaid code and saving it as a PNG image in binary format for further use in an automation workflow.
- Creating a PDF document of a Mermaid sequence diagram to attach to an email or store in a document management system.
- Rendering an SVG diagram from Mermaid code to embed in a web page or export for vector graphic editing.
Properties
| Name | Meaning |
|---|---|
| Mermaid Code | The Mermaid diagram code to render, provided as a string input. |
| Output Format | The format of the output diagram file, options include PNG, SVG, or PDF. |
| Binary Property Name | The name of the binary property where the rendered diagram data will be stored. |
| File Name | The file name for the binary data; if empty, a name is auto-generated. |
| Theme | The visual theme applied to the diagram, such as default, dark, forest, or neutral. |
| Background Color | Background color for the diagram. |
| Width | Width of the output image in pixels (only applicable for PNG format). |
| Height | Height of the output image in pixels (only applicable for PNG format). |
Output
Binary
The node outputs the rendered diagram as binary data encoded in base64, stored under the specified binary property name. The binary data includes the diagram file content, MIME type, file name, and file extension.
JSON
success- Indicates if the rendering was successful.format- The output format of the diagram (png, svg, pdf).fileName- The file name of the rendered diagram.binaryPropertyName- The name of the binary property containing the diagram data.
Dependencies
- Mermaid CLI executable (mmdc) must be available in the environment, typically requiring Puppeteer and Chromium browser dependencies.
Troubleshooting
- Common issues include Mermaid CLI execution failures due to missing or misconfigured Puppeteer/Chromium environment. Ensure the executable path and environment variables are correctly set.
- File system permission errors when writing or reading temporary files can cause failures; verify permissions for the system temp directory.
- Invalid Mermaid code syntax will cause rendering to fail; validate Mermaid code before rendering.
- If the output format is unsupported or incorrectly specified, the node will throw an error.
Links
- Mermaid Official Documentation - Official documentation for Mermaid syntax and usage.
- Mermaid CLI GitHub Repository - Source and documentation for the Mermaid CLI tool used for rendering diagrams.