This extension adds support for admonition blocks (callouts) in odoc documentation. Admonitions are used to highlight important information, warnings, tips, and other notable content.
opam install odoc-admonition-extensionOnce installed, the extension is automatically loaded by odoc.
Use the @admonition tag variants in documentation comments:
(** Some documentation.
@admonition.note This is a note with important information.
*)The extension supports the following tag variants:
Tag | Purpose |
|---|---|
| General supplementary information |
| Helpful suggestions and best practices |
| Potential issues or things that could go wrong |
| Critical information that should not be missed |
Admonitions are especially useful in module and function documentation:
(** Connect to a database.
@admonition.warning This function will block until the connection
is established. Use {!connect_async} for non-blocking connections.
@admonition.tip For connection pooling, see {!Pool.create}.
*)
val connect : config -> tThe extension generates HTML with appropriate CSS classes for styling. Each admonition type has a distinct visual appearance with colors that match its purpose:
The CSS is automatically included when the extension is loaded and supports both light and dark modes.