markdownumlcommentsplantuml

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:

Is there a possibility here?


Solution

  • 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