Mermaid Render Plugin
The Mermaid Render plugin gives the agent a render_mermaid tool that turns Mermaid diagram source into an SVG or PNG image file on disk. It drives a headless Chromium-family browser to render the diagram with mermaid.js.
Configuration
plugins:
- module: codumentor.plugins.mermaid_render
class: MermaidRenderPlugin
args:
enabled: true
target_agents: "main"
timeout: 30
# mermaid_js_url: "file:///opt/mermaid/mermaid.min.js" # for offline use
Parameters
- enabled (optional): Whether the plugin is active (default:
true) - target_agents (optional): Which agents receive the tool —
"main","subagent", or"all"(default:"main") - timeout (optional): Per-render timeout in seconds (default:
30) - mermaid_js_url (optional): Where to load
mermaid.jsfrom inside the browser (default: the jsDelivr CDNmermaid@11). Point it at afile://path or self-hosted copy for offline/restricted networks. - default_theme (optional):
"default","dark","forest","neutral", or"base"(default:"default") - default_background (optional): CSS background colour;
"transparent"is meaningful only for PNG (default:"white")
Tool Reference
| Tool | Description |
|---|---|
render_mermaid | Render Mermaid source to output_path. Optional format (svg/png, defaults from the path's extension), theme, and background. Returns the absolute path plus metadata (format, size, theme). Parent directories are created as needed. |
Notes
- Requirements: a Chromium-family browser (Chrome, Edge, or Chromium) installed on the host. Availability is checked at startup; if it's missing, the first call returns an error with install instructions. Install with
pip install playwright && playwright install chromium. - Rendering uses Mermaid's
securityLevel: 'strict'to mitigate diagram-based XSS. background: "transparent"withformat: "png"produces a PNG with an alpha channel.- Users can enable/disable the plugin for themselves via a settings widget.