Module Mermaid_extensionSource
Mermaid diagram extension for odoc.
Renders {@mermaid[...]} code blocks as diagrams. By default uses client-side JavaScript, but can render server-side to PNG/SVG with format option (requires mermaid-cli/mmdc).
Example:
{@mermaid theme=forest[
graph LR
A[Start] --> B{Decision}
B -->|Yes| C[OK]
B -->|No| D[Cancel]Mermaid.js CDN URL
Generate a unique ID for each diagram
Source
val get_theme :
[< `Binding of
string Odoc_parser.Loc.with_location
* string Odoc_parser.Loc.with_location
| `Tag of 'a ]
list ->
stringExtract option values
Source
val get_format :
[< `Binding of
string Odoc_parser.Loc.with_location * 'a Odoc_parser.Loc.with_location
| `Tag of 'b ]
list ->
'a optionSource
val get_filename :
[< `Binding of
string Odoc_parser.Loc.with_location * 'a Odoc_parser.Loc.with_location
| `Tag of 'b ]
list ->
'a optionSource
val get_dimensions :
[< `Binding of
string Odoc_parser.Loc.with_location * 'a Odoc_parser.Loc.with_location &
string Odoc_parser.Loc.with_location
* 'b Odoc_parser.Loc.with_location
| `Tag of 'c & 'd ]
list ->
'b option * 'a optionBuild inline style string from dimensions
HTML-escape content for safe embedding
Puppeteer config for environments that need --no-sandbox
Run mmdc (mermaid-cli) to render to a specific format
Runtime JS for mermaid — follows the MutationObserver pattern from the extension docs so diagrams render on both direct load and SPA navigation.
CSS for mermaid diagrams
Extension documentation