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]
Sourcemodule Block = Api.Block
Sourcemodule Inline = Api.Inline
Sourceval mermaid_js_url : string

Mermaid.js CDN URL

Sourceval diagram_counter : int ref

Generate a unique ID for each diagram

Sourceval fresh_id : unit -> string
Sourceval get_theme : [< `Binding of string Odoc_parser.Loc.with_location * string Odoc_parser.Loc.with_location | `Tag of 'a ] list -> string

Extract option values

Sourceval get_format : [< `Binding of string Odoc_parser.Loc.with_location * 'a Odoc_parser.Loc.with_location | `Tag of 'b ] list -> 'a option
Sourceval get_filename : [< `Binding of string Odoc_parser.Loc.with_location * 'a Odoc_parser.Loc.with_location | `Tag of 'b ] list -> 'a option
Sourceval 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 option
Sourceval make_style : string option -> string option -> string

Build inline style string from dimensions

Sourceval html_escape : string -> string

HTML-escape content for safe embedding

Sourceval puppeteer_config : string

Puppeteer config for environments that need --no-sandbox

Sourceval run_mmdc : theme:string -> format:string -> string -> (bytes, string) result

Run mmdc (mermaid-cli) to render to a specific format

Sourceval mermaid_css : string

CSS for mermaid diagrams

Sourceval extension_info : Api.extension_info

Extension documentation