Module Msc_extensionSource

Message Sequence Chart extension for odoc.

Renders {@msc[...]} code blocks as sequence diagrams. By default uses client-side JavaScript (mscgen-inpage), but can render server-side to PNG/SVG with format option (requires mscgen).

Example:

  {@msc format=png width=600px[
    msc {
      a, b, c;
      a -> b [label="request"];
      b -> c [label="forward"];
      c -> b [label="response"];
      b -> a [label="reply"];
    }
Sourcemodule Block = Api.Block
Sourcemodule Inline = Api.Inline
Sourceval mscgen_js_url : string

MscGen.js CDN URL - the inpage version auto-renders on DOMContentLoaded

Sourceval loader_script : string

Script to load mscgenjs with defer-like behavior

Sourceval diagram_counter : int ref

Generate a unique ID for each diagram

Sourceval fresh_id : unit -> string
Sourceval get_style : [< `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

Extract CSS dimensions

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 run_mscgen : format:string -> string -> (bytes, string) result

Run mscgen to render to a specific format

Sourceval msc_css : string

CSS for MSC diagrams

Sourceval extension_info : Api.extension_info

Extension documentation