terrastruct / d2

D2 is a modern diagram scripting language that turns text to diagrams.
https://d2lang.com
Mozilla Public License 2.0
16.16k stars 399 forks source link

Move text labels above lines? #1977

Open tedyoung opened 2 weeks ago

tedyoung commented 2 weeks ago

I'm trying to use D2 for sequence diagrams, but I find the labeling of messages hard to read and prefer the text to be above the line (as in PlantUML and Mermaid) instead of in it. I tried the following:

shape: sequence_diagram
Player1 -> UI: Join game {
  label.near: outside-top-center
}

but the label.near doesn't seem to have an effect on the text label. Is this not supported?

bo-ku-ra commented 2 weeks ago

0.65 would not do it.

shape: sequence_diagram

Player1 -> UI:  Join game

Player1 -> UI:  {
source-arrowhead: Join game
}
Player1 -> UI:  {
target-arrowhead: Join game
}

https://play.d2lang.com/?l=&script=Ks5ILEi1UihOLSxNzUtOjU_JTEwvSszl4grISaxMLTJU0LVTCPW0UlDwys_MU0hPzE3FlKrmKs4vLUpO1U0sKsovz0hNTLFCUl6LRX1JYlF6agku9VyAAAAA__8%3D&