Repository navigation
d2-rs: a Rust port of D2 with byte-identical output (CLI and WebAssembly) #2958
nelsonjchen
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi all! I've been working on d2-rs, a Rust port of the D2 toolchain: the compiler, the Dagre, ELK and TALA layouts, the SVG renderer, PNG/PDF/PPTX/GIF export and the
d2CLI. It also builds as a WebAssembly package.The goal is identical output, not "close enough". Upstream's own tests are the oracle:
master(6a7b483) byte for byte, across all three layout engines.e2etests-clisuite passes, and differential runs on mutated inputs agree with Go.d2jsand about 3x faster, with the samecompile/renderAPI shape.Try it:
A note on how it was made: over about two months (September to early November 2026), most of the code was written by AI coding agents: OpenAI Codex for the first six weeks, then Claude supervising Codex. They worked against D2's test suites, and a change only landed if every golden stayed byte-identical. The README has the details, plus a list of known issues found by going beyond the upstream corpus.
It's an independent, unofficial project: not part of D2 or endorsed by its maintainers. It's MPL-2.0 like D2. If you'd rather it not use the D2 name, I'm happy to rename it.
Thanks to the D2 team for the language, and for a test suite thorough enough to make this possible.
All reactions