Add custom inline extensions to odoc
Support [{&name payload}] inline syntax in .mld pages and docstrings.
Plugins register handlers via [Registry.register_inline] in the odoc
extension API; each handler receives the raw payload string and
returns HTML that is spliced into the rendered output.
Implementation rides on the existing [Raw_markup] AST variant with a
synthetic target prefix [odoc-ext:<name>]. The lexer emits
[Raw_markup (Some ("odoc-ext:" ^ name), payload)] when it sees
[{&name payload}]; the HTML generator's [raw_markup] function detects
the prefix and dispatches to the inline-handler registry, falling
back to emitting the payload raw if no handler is registered.
This keeps the patch small (no new AST variant, no backend pattern
match audits) at the cost of a lightly-punned Raw_markup target. Can
be promoted to a proper variant later.
Two smoke-test plugins ship in odoc-jons-plugins:
{&kbd Ctrl-K} -> <kbd>Ctrl-K</kbd>
{&margin an aside} -> <span class="margin-note">an aside</span>
Both render end-to-end after [opam reinstall odoc odoc-jons-plugins].
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>