[variables substitution] Allow substitution inside map keys
Hello 🌱
At the time of writing this issue
Given this d2 description text:
vars: {
x: "Data"
}
cls: "SomeClass" {
shape: class
}
cls."Process(Input input)": ${x}Output
cls."Process(${x}Input input)": ${x}Output
This link shows that variable substitution inside a key of the map cls is not effective:
Feature Request
I would like the same source code to generate this image instead (substituing the variable x containing the value Data:
Would this be a fair request to make?
I think is specific to class shapes, because all other keys can have label affect their final render text.
If we allow substitutions in map keys, it becomes too confusing to reference (e.g. point a connection to it).
I'm not sure what to do here other than introduce a new keyword specific to class shape, which is last resort. Will put this on backburner until I can think of something better or someone else runs into it.