Using UML in doxygen markdown page
Asked Answered
C

1

7

I am using doxygen for my personal project and desire to use any type of UML language on page created by myself (markdown page). I do not mean to use it in code (it does work), but on a document created by myself, refer to example underneath:

# Example

sequenceDiagram
    participant Alice
    participant Bob
    Alice->>John: Hello John, how are you?
    loop Healthcheck
        John->>John: Fight against hypochondria
    end
    Note right of John: Rational thoughts <br/>prevail!
    John-->>Alice: Great!
    John->>Bob: How about you?
    Bob-->>John: Jolly good!

```plantuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response

Alice -> Bob: Another authentication Request
Alice <-- Bob: Another authentication Response
```

```mermaid
sequenceDiagram
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob:Another authentication Response
Bob --> Alice: Another authentication Response
```

@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response

Alice -> Bob: Another authentication Request
Alice <-- Bob: Another authentication Response
@enduml

\startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response

Alice -> Bob: Another authentication Request
Alice <-- Bob: Another authentication Response
\enduml

And here is the output:

Result

While this text works (mermaid) for typora and plantuml generates together with mermaid on gitlab.

doxygen -x Doxyfile output:

# Difference with default Doxyfile 1.8.17 (9b14bf58c30a02ef19abebec280568532dc58ed4)
PROJECT_NAME           = Name
PROJECT_NUMBER         = 0.0.1
PROJECT_BRIEF          = "Brief"
OUTPUT_DIRECTORY       = out
INLINE_INHERITED_MEMB  = YES
INPUT                  = ./files \
                         ../src/
RECURSIVE              = YES
PLANTUML_JAR_PATH      = /home/<SURNAME>/Installations/plantuml.jar

Question is:

How to use uml diagrams in custom markdown file in doxygen.

Chalmer answered 3/2, 2020 at 22:39 Comment(10)
Which version of doxygen are you using? You probably want to use the \startuml / \enduml commands (as you tried at the last lines). Regarding the triple backticks there is already an issue: github.com/doxygen/doxygen/issues/7543 . Why did you used the backslashes before the backticks? Do you get any warnings?Jandel
@Jandel I noted that backticks are necessary for stack to not split code block into parts, my doxygen version is 1.8.16 (or 15, don't have access to machine RN, but it is not later than november as I build it from source). The \startuml | \enduml markers did not worked either.Chalmer
@qwerty_so It might not be obvious, sorry gonna add it. How to use uml diagrams in custom markdown files, in doxygen.Chalmer
You need to edit your question. A comment is not enough.Working
Regarding the "The \startuml | \enduml markers did not worked either.", this must have to do something with your installation. Did you install plantuml? What is in your PLANTUML_JAR_PATH in your doxygen configuration file (Doxyfile). Did you get a warning? Please rerun with doxygen -d extcmd to give the commands as run by doxygen. When you build it in November 2019 from git it is the master version (between 1.8.16 and 1.8.17, please give the output of doxygen -v). For easy comparison of settings also provide the output of doxygen -x Doxyfile.Jandel
The way to use plantuml in custom markdown file in doxygen is by way of the method mentioned already by you with @startuml / @enduml.Jandel
@albert, first of all – thank you for helping. I have tested all things you asked (edited question). I was indeed missing PLANTUML_JAR_PATH, which I already fixed, but effect isn't different. I have added aswell both verrsion (with @ and with `` into tested code samples.Chalmer
Okay, @albert. I am just foolish man, with to quick hands for his skill/mind. I did not removed "out" folder. Once I removed the out, everything went smoothly. Code has spit out errors, which I easily fixed on my own. Thank you for great amount of help!Chalmer
Fortunately the problem is solved. The plantuml is indeed sometimes a bit cumbersome, to regenerate one has to remove the inline_umlgraph_cache_all.pu file in the OUTPUT_DIRECTORY otherwise doxygen thinks the files were already generated (unless one of the @startuml codes changed) .Jandel
I think this does only work when the plantuml commands are not quoted, e.g. like: ``` text .... @startuml ... @endumlIsoleucine
B
1

It is probably too late for you but doxygen added now the function to integrate plantuml in markdown with version 1.9.4.

There you can see the examples of how you can include plantuml in your markdown file:

https://github.com/doxygen/doxygen/pull/9198

Now it's possible to use backticks like this:

```plantuml

Your Diagram

```
Bunkmate answered 1/7, 2022 at 8:38 Comment(1)
While I did not expect this question to get so much traction, I find this answer fascinating. I will test it (at some point) and accept the answer if it works ;)Chalmer

© 2022 - 2024 — McMap. All rights reserved.