PlantUML diagrams
Writerside supports adding diagrams using PlantUML. Besides various UML diagrams, you can visualize JSON and YAML, create Gantt charts and mind maps, and many other types of diagrams.
To add a PlantUML diagram, use a code block with the language set to plantuml
:
The result will look as follows:
Reference PlantUML diagram from file
If you have a file with PlantUML code, you can reference it instead of copying the PlantUML code into the code block. For more information, see Reference code from file.
Or via a relative path:
Examples
Here are a couple of examples:
Class diagram
For more examples of class diagrams, see https://plantuml.com/class-diagram
Use case diagram
For more examples of use case diagrams, see https://plantuml.com/use-case-diagram
JSON data
For more examples of JSON data diagrams, see https://plantuml.com/json
Gantt chart
For more examples of Gantt charts, see https://plantuml.com/gantt-diagram
Mind map
For more examples of mind maps, see https://plantuml.com/mindmap-diagram
Troubleshooting
Here are some possible issues that you might encounter and how to fix them:
- Cannot find Graphviz
In the rendered output, you see the following message:
Dot Executable: /opt/local/bin/dot Dot executable does not exist Cannot find Graphviz. You should try @startuml testdot @enduml or java -jar plantuml.jar -testdotPlantUML uses Graphviz/DOT to compute node positioning for some UML diagrams. If you see the previous message in your rendered output, it means that the machine where you are building the topic files does not have Graphviz.
Install Graphviz as described in the installation guide.
- Syntax Error
For XML topics or when using semantic code blocks in MD topics, make sure there are no
<
and>
characters in the PlantUML code. You can either wrap the whole contents of the code block in aCDATA
section to interpret it literally or use character references:<
and>
.<code-block lang="plantuml"> @startuml User << Human >> @enduml </code-block><code-block lang="plantuml"> <![CDATA[ @startuml User << Human >> @enduml ]]> </code-block><code-block lang="plantuml"> @startuml User << Human >> @enduml </code-block>- No variables
By default, Writerside ignores variables in PlantUML code and renders them literally. If you want to add something like a version via a variable defined in your project, set
ignore-vars="false"
.<var name="v1" value="1.0"/> <var name="v2" value="2.0"/> <code-block lang="plantuml"> @startuml [Component] --> "Interface %v1%" [Component] --> "Interface %v2%" @enduml </code-block><var name="v1" value="1.0"/> <var name="v2" value="2.0"/> <code-block lang="plantuml" ignore-vars="false"> @startuml [Component] --> "Interface %v1%" [Component] --> "Interface %v2%" @enduml </code-block>