Mermaid Render
Gives the agent a render_mermaid tool that turns Mermaid source into an SVG or PNG file. Rendering uses a Chromium-family browser and mermaid.js (same family of library the web UI uses).
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" # offline
- enabled (optional, default
true). - target_agents (optional, default
"main"):"main","subagent", or"all". - timeout (optional, default
30): Per-render timeout in seconds (minimum 1). - mermaid_js_url (optional): Where the browser loads
mermaid.js(default: jsDelivrmermaid@11). Use afile://path or a self-hosted copy on air-gapped hosts. - default_theme (optional):
"default","dark","forest","neutral", or"base"(default"default"). - default_background (optional): CSS colour;
"transparent"is meaningful for PNG (default"white").
Users can enable or disable the plugin for themselves in settings.
Tool: render_mermaid
| Argument | Required | Description |
|---|---|---|
source | yes | Mermaid diagram source. |
output_path | yes | Where to write the image. Relative paths use the working directory; parent dirs are created. |
format | no | svg or png. Defaults from the path extension, otherwise svg. |
theme | no | Overrides default_theme. |
background | no | Overrides default_background. |
Returns the absolute path plus format, size, and theme.
Notes
- Browser: Chrome, Edge, or Chromium must be installed on the host. If none is found, the first call returns install instructions. A previously installed Playwright Chromium (
~/.cache/ms-playwright) is reused if present; otherwise a normal system browser is enough. Non-standard location: setCODUMENTOR_CHROME_PATHto the binary. - Diagrams are rendered with Mermaid
securityLevel: 'strict'. background: "transparent"with PNG produces an alpha channel.