在 doxygen Markdown 页面中使用 UML

Bla*_*ack 5 markdown uml doxygen plantuml mermaid

我正在将 doxygen 用于我的个人项目,并希望在我自己创建的页面(markdown 页面)上使用任何类型的 UML 语言。我并不是想在代码中使用它(它确实有效),而是在我自己创建的文档上,请参阅下面的示例:

# 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
Run Code Online (Sandbox Code Playgroud)

这是输出:

结果

虽然本文适用于(mermaid)typora,但 plantuml 与 gitlab 上的 mermaid 一起生成。

doxygen -x Doxyfile 输出:

# 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
Run Code Online (Sandbox Code Playgroud)

问题是:

如何在 doxygen 中的自定义 Markdown 文件中使用 uml 图。

小智 1

对你来说可能已经太晚了,但 doxygen 现在在 1.9.4 版本中添加了将 plantuml 集成到 markdown 中的功能。

您可以在其中看到如何将 plantuml 包含在 Markdown 文件中的示例:

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

现在可以像这样使用反引号:

```plantuml

Your Diagram

```
Run Code Online (Sandbox Code Playgroud)