plantuml-stdlib / C4-PlantUML

C4-PlantUML combines the benefits of PlantUML and the C4 model for providing a simple way of describing and communicate software architectures
MIT License
6.33k stars 1.1k forks source link

Support of "all" PlantUML elements can be enabled #337

Closed kirchsth closed 7 months ago

kirchsth commented 7 months ago

related to https://github.com/plantuml-stdlib/C4-PlantUML/issues/336. The only difference is that the PlantUML elements can be defined via $baseShape (I could be that I combine $baseShape with $shape in one of the next releases therefore $baseShape and not $renderAs)

Optional support of additional PlantUML elements

More often a full support of all PlantUML elements are requested.
They can be set via the new optional baseShape="...." argument of the calls

The already specified ...Db...() and ...Queue...() calls are not extended.

But based on the additional (internal) overhead it has to be explicit enabled via ENABLE_ALL_PLANT_ELEMENTS. It can be set with following 2 options

@startuml
!ENABLE_ALL_PLANT_ELEMENTS = 1
!include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Component.puml
...
@enduml

If ENABLE_ALL_PLANT_ELEMENTS is not set, the diagrams displays the requested "PlantUML element" but the style is not correct displayed.

A simple sample with additional "PlantUML elements":

@startuml
!ENABLE_ALL_PLANT_ELEMENTS = 1
!include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Component.puml

Component(comp, "Copy component")

Component(config, "Config component", $baseShape="package")

ComponentDb(dbA, "DB A")
' alternative syntax for ComponentDb() with $baseShape="database"
Component(dbB, "DB B", $baseShape="database")

Rel_U(comp, config, "Configured by")
Rel_L(comp, dbA, "Reads from")
Rel_R(comp, dbB, "Writes to")

SHOW_LEGEND()
@enduml

Sample with PlantUML elements

List of supported PlantUML elements

PlantUML element Support Comment
rectangle already supported (works even without ENABLE_ALL_PLANT_ELEMENTS)
database already supported (works even without ENABLE_ALL_PLANT_ELEMENTS)
queue already supported (works even without ENABLE_ALL_PLANT_ELEMENTS)
node should not be used, already defined for Node() (works even without ENABLE_ALL_PLANT_ELEMENTS)
person should not be used, already defined for Person() (works even without ENABLE_ALL_PLANT_ELEMENTS)
actor requires ENABLE_ALL_PLANT_ELEMENTS
agent requires ENABLE_ALL_PLANT_ELEMENTS
artifact requires ENABLE_ALL_PLANT_ELEMENTS
boundary requires ENABLE_ALL_PLANT_ELEMENTS
card requires ENABLE_ALL_PLANT_ELEMENTS
circle requires ENABLE_ALL_PLANT_ELEMENTS
cloud requires ENABLE_ALL_PLANT_ELEMENTS
collections requires ENABLE_ALL_PLANT_ELEMENTS
control requires ENABLE_ALL_PLANT_ELEMENTS
entity requires ENABLE_ALL_PLANT_ELEMENTS
file requires ENABLE_ALL_PLANT_ELEMENTS
folder requires ENABLE_ALL_PLANT_ELEMENTS
frame requires ENABLE_ALL_PLANT_ELEMENTS
hexagon requires ENABLE_ALL_PLANT_ELEMENTS
interface requires ENABLE_ALL_PLANT_ELEMENTS
package requires ENABLE_ALL_PLANT_ELEMENTS
stack requires ENABLE_ALL_PLANT_ELEMENTS
storage requires ENABLE_ALL_PLANT_ELEMENTS
usecase requires ENABLE_ALL_PLANT_ELEMENTS
usecase/ requires ENABLE_ALL_PLANT_ELEMENTS
actor/ requires ENABLE_ALL_PLANT_ELEMENTS, not working (font color not changed to $bkColor) - and/or conflict with existing?
label requires ENABLE_ALL_PLANT_ELEMENTS, not working (font color not changed to $bkColor)

If ENABLE_ALL_PLANT_ELEMENTS is not set, the diagrams displays the requested "PlantUML element" but the style is not correct.

It can be tested via my extended branch

Sample with all PlantUML elements

(sometime the PlantUML server has no access to the referenced files, if this is the case please try it with your local system) BR Helmut