Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inline comment in PlantUML

Is it possible to write an inline comment in the PlantUML (Markdown format)?

For example, I would like to achieve the following result

@startuml
    participant Alice as A
    participant Bob as B

    A -> B    ' Here I would like to have my comment
    ...
@enduml

I know that the following notations can be used:

' This is a comment on a single line
A -> B: Hello World
/' Multiple
comment
lines '/

What I find strange is that this style:

participant Alice as A    /' Why does this comment work? '/

works for the participants and can be used successfully. Only with the references this does not work.

The solutions with the ' and -- notation which were mentioned here do not work properly.

I already checked the following sources:

  • https://forum.plantuml.net/1353/is-it-possible-to-comment-out-lines-of-diagram-syntax
  • https://plantuml.com/de/commons

Is there a possibility here?

like image 772
41 72 6c Avatar asked Jan 17 '26 08:01

41 72 6c


1 Answers

According to the latest specification, you have three options to add comment section in a *.puml file:

1) Simple comment

Everything that starts with simple quote ' is a comment.

@startuml
'Line comments use a single apostrophe
@enduml

2) Block comment

Block comment use C-style comments except that instead of * you use an apostrophe ', then you can also put comments on several lines using /' to start and '/ to end.

@startuml
/'
many lines comments
here
'/
@enduml

3) Put block comment on the same line

@startuml
/' case 1 '/   A -> B : AB-First step 
               B -> C : BC-Second step
/' case 2 '/   D -> E : DE-Third step
@enduml

Reference: QA-3906 and QA-3910

like image 151
zappee Avatar answered Jan 20 '26 11:01

zappee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!