Skip to content

Allow literal punctuation, unquoted hex colors, and nested board names - #3054

Merged
alixander merged 2 commits into
masterfrom
relax-unambiguous-syntax
Nov 26, 2026
Merged

alixander merged 2 commits into
masterfrom
relax-unambiguous-syntax

Conversation

@alixander

Copy link
Copy Markdown
Collaborator

Human


AI

Allow common labels and shape names to be written directly.

  • Dollar signs are literal in bare and double-quoted values unless they open a substitution. The existing whitespace before a substitution brace still works.
  • Brackets, ampersands, and angle brackets can appear in shape names and labels where they have no structural role. Arrays, filters, indexed connections, and reverse arrows retain their syntax.
  • A complete #RGB or #RRGGBB after a colon is a colour value. A hash at the start of a line or array entry, or after an existing value, still starts a comment.
  • Inside a container, layers, scenarios, and steps can be created, styled, connected, and edited as shapes. At a board root they retain their board semantics.

For example, source that previously needed quoting now renders directly.

direction: right
<stdin> -> Read & parse -> rows[0]

release: {
  layers -> scenarios -> steps
  steps.style.fill: #CDE
}
release.steps -> rows[0]: cost $5

Verified with the full Go test suite. Compared the CLI output for four previously rejected examples against equivalent escaped or quoted sources compiled on master. All four SVG comparisons were byte-identical.

  • sent from alixander's Codex

@alixander
alixander merged commit 7de5815 into master Nov 26, 2026
11 checks passed
@alixander
alixander deleted the relax-unambiguous-syntax branch November 26, 2026 13:19
alixander added a commit that referenced this pull request Nov 26, 2026
…lies

Master accepts theme names (#3053), unambiguous literals and nested board
names (#3054) and hash-prefixed labels and keyword variable names
(#3056), and publishes D2.js nightlies (#3055). d2compiler/compile.go
imports both master's d2themescatalog and this branch's htmlentity.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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