Module Dot_extensionSource
Graphviz/DOT diagram extension for odoc.
Renders {@dot[...]} code blocks as diagrams. By default uses client-side JavaScript (Viz.js), but can render server-side to PNG/SVG with format option.
Example:
{@dot layout=neato[
digraph G {
a -> b -> c;
b -> d;
}The Viz.js library URL for client-side rendering
Generate a unique ID for each diagram
Source
val get_layout :
[< `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 optionCheck if content looks like a complete DOT graph
Wrap content in a digraph if needed
Build inline style string from dimensions
Run the dot command to render to a specific format
Runtime JS for dot — follows the MutationObserver pattern so diagrams render on both direct load and SPA navigation. DOT source and layout engine are stored in data attributes on the container div.
CSS for dot diagrams
Extension documentation