Ability to specify maximum note / mesages width

0 votes
asked May 20, 2024 in Wanted features by Ilias (180 points)
When writing long notes (anywhere) of messages (in a sequence diagram) it is required to manually enter carriage returns.
Ideally it should be possible to have a way to define a max width after which plantuml will automatically enter carriage returns.

1 Answer

+1 vote
answered May 20, 2024 by The-Lu (89,080 points)

Hello I., and all,

For that you can use style as:

CodeOutput
@startuml

Alice->Bob : hello
note left: Long Long Long Long Long Long Long Long Long Long **note**

Bob->Alice : ok
note right: Long Long Long Long Long Long Long Long Long Long **note**

Bob->Bob : I am thinking
note left
Long Long Long Long Long Long Long Long Long Long Long Long 
Long Long Long Long Long Long Long Long Long Long **note**
end note
@enduml
@startuml

<style>
note {
  MaximumWidth 150
}
</style>

Alice->Bob : hello
note left: Long Long Long Long Long Long Long Long Long Long **note**

Bob->Alice : ok
note right: Long Long Long Long Long Long Long Long Long Long **note**

Bob->Bob : I am thinking
note left
Long Long Long Long Long Long Long Long Long Long Long Long 
Long Long Long Long Long Long Long Long Long Long **note**
end note
@enduml


Enjoy,

See also similar request here:

Regards,
Th.

commented May 20, 2024 by Ilias (180 points)
That is great!
Thank you for pointing it out. It helps a bit.
Is there a way to specify a widith per note?
commented May 20, 2024 by The-Lu (89,080 points)

Hello I., and all,

For that you can use sterotype as:

@startuml

<style>
.n1 {
  MaximumWidth 250
}
.n2 {
  MaximumWidth 150
}
.n3 {
  MaximumWidth 100
}
</style>

Alice->Bob : hello
note left <<n1>>: Long Long Long Long Long Long Long Long Long Long **note** 

Bob->Alice : ok
note right <<n2>>: Long Long Long Long Long Long Long Long Long Long **note**

Bob->Bob : I am thinking
note left <<n3>>
Long Long Long Long Long Long Long Long Long Long Long Long 
Long Long Long Long Long Long Long Long Long Long **note**
end note
@enduml


Enjoy,
Regards,
Th.

...