Skip to content

Allow hash-prefixed labels and keyword variable names - #3056

Merged
alixander merged 2 commits into
masterfrom
relax-hash-labels-and-variable-names
Nov 26, 2026
Merged

alixander merged 2 commits into
masterfrom
relax-hash-labels-and-variable-names

Conversation

@alixander

Copy link
Copy Markdown
Collaborator

Human


AI

Bare labels can start with a hash after a colon. Channels and ticket numbers can now be written directly.

channel: #oncall # team channel
ticket: #42
channel -> ticket: triage

Every D2 keyword can name a variable. This includes layers, scenarios, steps, and classes, as well as dotted declarations and lookups. Existing configuration, legends, and reusable shape or style templates keep their semantics. When a diagram defines distinct quoted and unquoted variables with the same keyword name, its references retain their original bindings.

vars: {layers: Gateway; classes: Worker; steps: 3}
entry: ${layers}
job: ${classes}
entry -> job: ${steps} steps

The existing comment rules still apply at entry start and after a value. Colour properties validate the resulting scalar, so style.fill: #oncall still reports an invalid colour.

Both examples render byte-identically to their quoted equivalents on the base compiler.

  • sent from alixander's Codex

@alixander
alixander merged commit 5d40877 into master Nov 26, 2026
11 checks passed
@alixander
alixander deleted the relax-hash-labels-and-variable-names branch November 26, 2026 13:46
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