Legend
Use a special variable, d2-legend
, to declare a legend.
Hiding shapes
Since a -> b
declares 3 things (1 connection and 2 shapes), 3 things will show up on the
legend. If you only intended to show the connection in the legend, you can set the opacity
of shapes to exclude them from the legend.
Rename "legend"
You may rename "legend" by simply giving it a label. This is particularly useful for non-English diagrams.