我正在使用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
以下是输出结果:
虽然这个文本在typora中可用(mermaid),但在gitlab上与mermaid一起生成的plantuml也能够工作。
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
问题是:
如何在Doxygen的自定义markdown文件中使用UML图表。
\startuml
/\enduml
命令(就像你在最后几行尝试的那样)。关于三个反引号,已经有一个问题:https://github.com/doxygen/doxygen/issues/7543。为什么在反引号之前使用反斜杠?你有收到任何警告吗? - albertPLANTUML_JAR_PATH
是什么? 您是否收到警告? 请使用doxygen -d extcmd
重新运行以提供由doxygen运行的命令。 如果您从git构建它,则为2019年11月的主版本(1.8.16和1.8.17之间),请提供doxygen -v
的输出结果进行简单的设置比较。 - albertPLANTUML_JAR_PATH
,但我已经修复了它,但效果并没有改变。我还在测试代码示例中添加了两个版本(使用@
和\
)。 - BlackOUTPUT_DIRECTORY
中的inline_umlgraph_cache_all.pu
文件,否则Doxygen会认为文件已经生成(除非其中一个@startuml
代码发生了变化)。 - albert