我只能假设 PlantUML 尽可能地像 UML。虽然可以[...]
向元素添加长描述 ( ),但我几乎可以肯定它仅适用于通常不包含子元素的某些元素类型(例如活动元素、用例等)。但是,对于更正式的图表,注释或进一步解释概念所需的任何“文本”都应作为注释或标注添加。
我在很多个月前遇到了这个问题,并且确实按照您的要求进行了操作。我挖掘了我的图表档案,发现了一个非常接近您想要实现的示例。
因此,为了回答您的问题,在文件夹等分组元素中包含描述性文本和 UML 元素的解决方案如下:
@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

正如您将注意到的,连接用于调整文本位置,并且可能需要一些更复杂的处理,具体取决于文本的大小和元素的数量。
从早期开始,我就更接近于 UML 规范。有关评论的更多详细信息,请参阅此答案。不仅更容易添加注释,而且 PlantUML 代码也更简单。也就是说,以下是使用此方法的上述变体。
@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
