MSC Extension for odoc

This extension adds support for Message Sequence Charts (MSC) in odoc documentation. MSC is a graphical and textual language for describing interactions between components.

Installation

opam install odoc-msc-extension

Once installed, the extension is automatically loaded by odoc.

Usage

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"];
}
]}

Examples

Simple Request-Response

Three-Party Interaction

With Conditions and Boxes

Parallel Messages

Authentication Flow

Options

The extension supports the following options:

How It Works

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.

Syntax Reference

MSC syntax basics:

See the MscGen documentation for the complete syntax reference.