Feature request: Sequence diagram notes over multiple actors
Currently, d2 only have notes on actors. Would be nice to have multiline notes. Provided example on PlantUML and Mermaid.
PlantUML
@startuml
A -> B : hello
note over A, B
{
"message": "hello"
}
end note
@enduml
Mermaid
Mermaid cannot do multiline notes as easy as PlantUML.
sequenceDiagram
A->>+B: hello
Note over A, B: { "message": "hello" }
Just noticed the discussion section. Should I one and link this issue?
@bentinata no this is fine =). thank you for bringing it up!
i don't really understand the use case though. like this looks like a note for the message instead of the actors.
https://play.d2lang.com/?l=&script=AjvXSqE4tbA0NS85NT4lMzG9KDGXy5HLiYsrLT8_KbHISkGpWiFGKTe1uDgxPTVGyUohRikjNScnP0ZJoVZJoZpLQcFRQddOwclKASzMVcvFBROAKszDYwAXIAAA__8%3D&
@alixander
I usually use notes on PlantUML as some sort of place to put sample payload. Let me know if this is a wrong sequence diagram usage.
I also tried @bo-ku-ra suggestion.
I think I have the same issue or question as the original poster. Is there any way to add code to a sequence diagram?
In the examples above a piece of JSON is requested, but it could be anything really, some HTML, or any other message format.
Is there a way to add a piece of code to a sequence diagram, using any of D2lang's available syntax?
For example is there any way to add this
message: |json
{ "message": "hello" }
|
to a sequence diagram anywhere? In a message, on a note, etc.
None of the links to https://play.d2lang.com in this thread are working for me, they all render two empty white boxes when they're clicked. So I just added the example code snippet and resulting image as a screenshot to this message.
i do not like d2's sequence_diagram. (i especially hate that 'Spans' needs to be named) therefore, i usually use mermaid.
forced workaround in d2
shape: sequence_diagram
a: |json
{ "message": "hello" }
|
b
a.note: |json
{ "message": "hello" }
|
message: |json
{ "message": "hello" }
| {
style.stroke-width: 1
a -- b: "" {style.stroke-width: 0}
}