render_diagram
Render Mermaid diagram definitions to PNG, SVG, PDF, or editable draw.io files, outputting base64 or writing to disk.
Instructions
Render Mermaid diagram syntax into a PNG, SVG, or PDF — or convert it to an editable draw.io (.drawio) file. Returns the result as base64-encoded data (drawio: XML text), or writes it to output_path if given. drawio format supports flowcharts only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| theme | No | Visual theme for the diagram. | default |
| width | No | Canvas width in pixels (PNG only). | |
| format | No | Output format. Defaults to png. drawio produces an editable draw.io XML file (flowcharts only). | png |
| pdfFit | No | Scale the PDF page to fit the diagram (PDF only). | |
| syntax | Yes | Mermaid diagram definition (e.g. flowchart, sequenceDiagram, etc.) | |
| background | No | Background colour (CSS colour string or "transparent"). | white |
| output_path | No | Absolute file path to write the result to. When given, the file is written to disk and no base64 data is returned — useful for documents destined for printing or formal submission. |