This extension adds support for Message Sequence Charts (MSC) in odoc documentation. MSC is a graphical and textual language for describing interactions between components.
opam install odoc-msc-extensionOnce installed, the extension is automatically loaded by odoc.
Use the {@msc[...]} tag to embed Message Sequence Charts:
{@msc[
msc {
a, b, c;
a -> b [label="request"];
b -> c [label="forward"];
c -> b [label="response"];
b -> a [label="reply"];
}
]}The extension supports the following options:
named-style - MscGen style: basic, lazy, classic, etc.width - CSS width (e.g., 500px, 100%)height - CSS heightformat - Output format: omit for client-side JS, or png/svg for server-side rendering (requires mscgen CLI tool)By default, diagrams are rendered client-side using the mscgen_js library loaded from a CDN. The extension injects the necessary <script> tags into the HTML output.
For server-side rendering, install the mscgen CLI tool and use format=png or format=svg.
MSC syntax basics:
a, b, c;a -> b [label="text"];a <- b [label="text"];a box a [label="text"];--- [label="text"];See the MscGen documentation for the complete syntax reference.