See it as a diagram
Everything below, as a diagram you can edit. Describe yours and see it in seconds.
No account needed · Editable canvas, not a picture
Raw HTML passes through, so iframes just work
mdBook renders Markdown with pulldown-cmark, which leaves inline HTML untouched and emits it into the output page as-is. No sanitizer runs afterward. That means an iframe pasted into a chapter renders exactly as written, with no plugin, no preprocessor, and no configuration.
The interactive form is the one to use when readers inspect details: they can pan and zoom the actual diagram inside the book instead of squinting at a fixed PNG. The frame is chrome-less apart from a small attribution link to the source diagram.
<iframe src="https://datadef.io/embed/my-platform-a1b2c3d4" style="width: 100%; height: 480px; border: none;" title="Platform architecture" ></iframe>
No build-time image processing means external URLs stay live
mdBook copies files from src into the book output verbatim and never downloads, hashes, or rewrites remote URLs. A Markdown image pointing at an external URL reaches the reader untouched, and the browser fetches it from the source at view time.
That is the property a live embed needs. A Datadef project shared public serves a permanent image URL that re-renders when the diagram changes, with an ETag from the last edit and a five minute cache lifetime. Edit the diagram and the book shows the new version within minutes, with no mdbook build and no redeploy. The first render after an edit can take a few seconds while a headless browser produces it; it is cached after that.
Preprocessors are for transforming content; embeds need none
mdBook extends through preprocessors declared in book.toml, programs that rewrite chapter content before rendering. Diagram tooling in this ecosystem usually lives there: mdbook-mermaid, for example, injects the assets that render fenced Mermaid blocks at view time. An embedded diagram needs none of that machinery, because nothing in the chapter has to be transformed: the URL is the integration.
The honest comparison: Mermaid in the same commit is the right call for small flows that belong to one chapter, and it reviews well in diffs. Generated layout struggles past roughly twenty nodes or when zones and grouped detail matter, which is where the embedded form with a real layout takes over. Where each approach tops out is covered in docs-as-code diagram limits.
Keeping the diagram current
The embed removes the re-export step; the diagram edit remains, and it happens entirely outside the book. Point an MCP-capable agent at the Datadef server, registry name io.datadef/mcp, and it can bring the diagram in line with the repository after a merge, no mdbook build involved. Be clear about the trigger, though: Datadef does not monitor repositories, so a CI job or a person invokes the agent, and one call later the book shows the new architecture. Agent API keys exist on paid plans.
Both embed forms exist only for projects shared public; a private project turns the URLs into 404s. For confidential systems, commit a static export next to the chapter and accept the staleness. And mdBook has no link checker for remote URLs by default, so a dead embed shows up as a broken image, not a failed build.
FAQ
Can I use an iframe in mdBook?
Does mdBook process or copy external images at build time?
How do I make an embedded diagram look right in mdBook dark themes?
Does an embedded diagram update without running mdbook build?
Should I use mdbook-mermaid or an embedded diagram?