Antora diagram formats
Antora does not force a diagram engine. DevCentr / antora-supplemental hubs support two first-class strategies (and a hybrid):
| Option | When to use | Theme story |
|---|---|---|
A — Bake SVG at build |
Default for hubs; PlantUML; offline/print; no JS required for the figure |
Fixed-color Kroki |
B — Client render engine |
Mermaid that must re-theme without dual SVG forks (DeepWiki-style) |
Mermaid |
Hybrid |
Bake PlantUML (or stable Mermaid) and keep selected Mermaid client-side |
Per-block choice on the same site |
Text formats at a glance:
| Format | AsciiDoc form | Engine path |
|---|---|---|
Mermaid |
|
Kroki bake or |
PlantUML |
|
Kroki build SVG (client PlantUML is harder; not shipped) |
Hand SVG |
|
Author file (+ optional Themed SVG pipeline) |
Option A — Bake SVG at build (Kroki / Themed SVG)
asciidoctor-kroki converts diagram blocks to SVG during antora when kroki-fetch-diagram: true.
Readers never call Kroki; the published page has an <img> (or you post-process into Themed SVG artifacts).
-
Works without JavaScript; good for print, SSR, and broken-CDN resilience.
-
PlantUML and Mermaid share one gateway.
-
Self-hosted Kroki avoids public
kroki.ioMermaid 500s.
-
Raw Kroki embeds are fixed-color —
html.dark-themedoes not recolor<img>pixels. -
Theme-aware figures need the Themed SVG pipeline (extra generate/check step) or dual light/dark files.
-
Incomplete dark text in adaptive SVGs surfaces as build WARNs (see below).
Playbook wiring (this hub)
asciidoc:
extensions:
- asciidoctor-kroki
attributes:
stem: latexmath
kroki-server-url: http://127.0.0.1:8000
kroki-fetch-diagram: true
Install: pnpm add -D asciidoctor-kroki in the playbook repo.
Self-hosted Kroki (local + CI)
Local sibling builds and GitHub Actions both use yuzutech/kroki + yuzutech/kroki-mermaid on http://127.0.0.1:8000unchecked.
pnpm kroki:up
pnpm build
pnpm kroki:down
Mermaid is a companion service — the gateway alone answers 503 for /mermaid/*.
CI starts the same images as job services.
One-off public server:
pnpm antora --attribute kroki-server-url=https://kroki.io antora-playbook-local.yml
Theme-aware figures (Themed SVG)
Post-process renderer SVG in CI:
| Source | Adapter | Contract |
|---|---|---|
Mermaid ( |
|
Themed SVGunchecked adaptive + host |
PlantUML ( |
|
same |
Serve with a [.themed-svg] image role so the hub runtime can inline the host SVG.
These adapters are general-purpose packages in dev-centr; Antora importance is compose/recommend (see facto-stackunchecked; GitHub: antora-supplemental/facto-stackunchecked), not forks into antora-supplemental.
Option B — Ship client render engines (Mermaid first)
DeepWiki-style sites keep Mermaid source in the page payload and draw SVG after JS.
Pre-JS HTML has no mermaid-* SVG ids; ids such as mermaid-pn8g0g8w28 appear only post-render.
That is why they can theme light/dark with Mermaid theme / themeVariables (and CSS) without dual checked-in SVG forks.
-
One source; theme follows
html.dark-themeon (re)render. -
No Kroki round-trip for those blocks; no Themed SVG generate step for them.
-
Requires JavaScript (and a Mermaid bundle / CDN).
-
PlantUML-in-browser is heavier (not shipped here).
-
SEO/print see source text or empty hosts until JS runs.
-
SoftNav pages must re-run the helper on
SoftNav.loaded(hubsite-mermaid.jsalready does).
How to enable on an Antora hub
Prefer the maintained packages from antora-supplemental/antora-diagram-enginesunchecked:
antora:
extensions:
- require: '@antora-supplemental/mermaid-client/antora'
# CDN default: pinned jsDelivr Mermaid 11.6.0
- require: '@antora-supplemental/diagram-lightbox'
asciidoc:
extensions:
- asciidoctor-kroki # PlantUML / other bake formats
attributes:
mermaid-client: ''
mermaid-client-mode: client
kroki-fetch-diagram: true
Theme partials (this hub): {{> mermaid-client-styles}} / {{> mermaid-client-scripts}} and {{> diagram-lightbox-styles}} / {{> diagram-lightbox-scripts}} in supplemental head/footer.
The Antora entries inject site-mermaid.js/css and lightbox assets into the UI catalog (CDN config via mermaid-client-config).
Do not also vendor duplicate site-mermaid.js / lightbox scripts in supplemental-ui — that double-inits Mermaid.
With mermaid-client-mode: client, [source,mermaid] listings become client hosts before Kroki bake (PlantUML and other formats still use Kroki).
Theming knobs: Mermaid themeVariables inside mermaid.initialize({…}) in site-mermaid.js, plus site-mermaid.css using --adt-* tokens.
Hybrid — choose per diagram or per site
| Goal | Pattern |
|---|---|
| Site mostly bake | Keep asciidoctor-kroki + kroki-fetch-diagram: true. Use [mermaid] / [plantuml] as today. |
| One Mermaid client-side | Keep Kroki for PlantUML / other Mermaid; author that figure as [.mermaid-client] + [source,text] (or pre.mermaid). |
| Site mostly client Mermaid | Require @antora-supplemental/mermaid-client/antora with mermaid-client-mode: client (this hub). Keep Kroki for PlantUML. |
When Kroki converts a [mermaid] block, the listing becomes an image — site-mermaid.js finds nothing to re-render (no double draw). That is intentional for Option A.
Diagram lightbox (zoom / pan)
UX name: lightbox. Package id: @antora-supplemental/diagram-lightboxunchecked
(patterns from chassis diagram-zoom).
-
In-article chrome on
.doc .imageblockand client Mermaid hosts: zoom in/out, reset, expand. -
Lightbox overlay: drag-pan, wheel-zoom, Esc/backdrop/close; labeled buttons; basic focus cycle.
-
SoftNav-safe; in-article wheel zoom requires Ctrl/Cmd so left-nav scroll is not stolen.
-
Styles use
--adt-*tokens (Valentus / DevCentr light+dark).
This hub requires the package in the playbook and includes {{> diagram-lightbox-styles}} / {{> diagram-lightbox-scripts}} (assets injected into the UI catalog).
Opt out of a single figure with role/class no-diagram-zoom when needed.
facto-stack pack (not Valentus core)
Valentus UI stays a lean theme.
Reusable playbook defaults (Valentus + Lunr + stem/math + Kroki diagrams + related essentials) live in the separate compose pack antora-supplemental/facto-stackunchecked — the facto-stack compose pack, discovered by pack name like a VS Code extension pack, not forced into the Valentus v2 rolling tag.
Client Mermaid + diagram lightbox (diagram-lightbox) are supported supplemental options on top of facto-stack, not Valentus core.
Related
-
Antora UI branding (DevCentr hub)
-
Internet Reliability (uses both formats)
-
antora-diagram-enginesunchecked (mermaid-client + diagram-lightbox)
-
Chassis diagram-zoom patternsunchecked