As I've seen from the examples in PlantUML you can have certain graphical objects with text in it like
folder folder1 [
Here you can have some explanation with
====
--Markdown-- //formatting// ~~elements~~
]
which renders to
You can also use folder
(among other elements) to group other items by nesting them:
folder folder2 {
folder folder3 [
text bla bla
]
artifact art2 [
more text
]
}
But currently I see no way to combine both - an object with some explaining text in it and nested elements.
Is that possible with PlantUML? (how?)
It is possible to put notes on message using the note left or note right keywords just after the message. You can have a multi-line note using the end note keywords.
You have to add an end statement to close the alt block. As a side note: You do not need to add the square brackets in your alt statements. PlantUML renders those itself.
File created by PlantUML, a UML diagram creator used within programs like Sublime Text Editor or programming language like HTML; same as the . PU file; contains code referenced by PlantUML to create diagram images that can be generated as . PNG or .
<u> or <u:#AAAAAA> or <u:[[color|colorName]]> for underline. <i> for italic. <s> or <s:#AAAAAA> or <s:[[color|colorName]]> for strike text. <w> or <w:#AAAAAA> or <w:[[color|colorName]]> for wave underline text.
I can only assume that PlantUML tries to be as UML-like as possible. While it is possible to add long descriptions ([...]
) to elements, I'm almost certain it was intended only for certain element types (e.g. activity elements, use cases, etc.), which generally do not contain sub-elements. However, for more formal diagrams, any "text" required to annotate or further explain a concept should be added as notes or callouts.
I ran into this issue many moons ago, and did do exactly as you are trying to do. I dug into my diagram archives and found an example that would be very close to what you want to achieve.
Thus, to answer your question, a solution for including both descriptive text and UML elements in a grouping elements such as folders, is as follows:
@startuml
skinparam rectangle<<desc>> {
backgroundColor Transparent
borderColor Transparent
titleFontColor Red
stereotypeFontColor Transparent
}
folder folder2 {
folder folder3 [
text bla bla
]
artifact art2 [
more text
]
rectangle f2<<desc>> [
Here you can have some explanation with
====
--Markdown-- //formatting// ~~elements~~
]
folder3 -[hidden]- f2
}
@enduml
As you will note, a connection is used to tweak text placement and may require some more complex finagling depends on the size of your text and the number of elements.
Since those early days, I have followed closer to the UML spec; see this answer for more details on comments. Not only is it easier to add comments, but PlantUML code is far simpler. That said, the following is a variant of the above using this approach.
@startuml
folder folder2 {
folder folder3 [
text bla bla
]
artifact art2 [
more text
]
}
note bottom of folder2
Here you can have some explanation with
====
--Markdown-- //formatting// ~~elements~~
end note
@enduml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With