Skip to content

Fix keyword names, hex style values and multi-board render - #11

Merged
h0rv merged 1 commit into
mainfrom
fix-quoting-render
Oct 23, 2026
Merged

h0rv merged 1 commit into
mainfrom
fix-quoting-render

Conversation

@h0rv

@h0rv h0rv commented Oct 23, 2026

Copy link
Copy Markdown
Owner

These three bugs turned up while writing an example for every feature:

  • Keyword names: Shape(name="shadow") was written as is, and D2 failed with "shadow must be style.shadow". The keyword list now matches D2 v0.9.0's full set, and every keyword is quoted when used as a name.
  • Hex colors: Style(fill="#dbeafe") was written as fill: #dbeafe, and D2 read the # as the start of a comment. Style values are now quoted when D2 needs it. Values you already quoted, like '"#274e13"', stay as they are.
  • Multi-board render: render() failed on any diagram with layers, scenarios or steps, because D2 can't write several boards to stdout. render() now takes target=, which defaults to the root board. target="layers.detail" renders one layer.

There's a test for each. Checked locally: all 104 tests pass, and ruff and ty are clean.

🤖 Generated with Claude Code

- Quote every D2 keyword used as a name (shadow, fill, top, ...), using
  the full keyword list from D2 v0.9.0.
- Quote style values D2 cannot read bare, such as #dbeafe, which D2
  otherwise reads as a comment.
- render() takes target=, default the root board, so diagrams with
  layers, scenarios or steps render instead of failing on stdout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@h0rv
h0rv merged commit 6124837 into main Oct 23, 2026
8 checks passed
@h0rv
h0rv deleted the fix-quoting-render branch October 23, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant