Sphinx PlantUML Extension

0.31 · active · verified Wed Apr 15

sphinxcontrib-plantuml is a Sphinx extension that enables the embedding of PlantUML diagrams directly into reStructuredText or Markdown documentation. It translates PlantUML text blocks into image files (PNG, SVG, PDF) during the Sphinx build process. The current version is 0.31, and the project maintains a fairly active release cadence, with multiple updates in recent years.

Warnings

Install

Imports

Quickstart

To quickly get started, first, create a Sphinx project. Then, modify your `conf.py` to include `sphinxcontrib.plantuml` in your `extensions` list. Crucially, ensure that the PlantUML Java executable is either in your system's PATH or explicitly configured using the `plantuml` variable in `conf.py`. Finally, embed PlantUML code directly into your reStructuredText files using the `.. uml::` directive.

# conf.py
import os

project = 'My Project'
copyright = '2026, Your Name'
extensions = [
    'sphinxcontrib.plantuml',
]

# Configure PlantUML executable path (essential if not in PATH)
# Replace '/path/to/plantuml.jar' with the actual path.
# If 'plantuml' command is in your system PATH, this line can be omitted.
# plantuml = 'java -jar /path/to/plantuml.jar'

# Optional: Set output format (default is 'png' for HTML)
# plantuml_output_format = 'svg_img'

# index.rst (or a new .rst file)
# Add the following to your .rst file:
# .. uml::
#    @startuml
#    Alice -> Bob: Hello
#    Bob -> Alice: Hi!
#    @enduml

# To build the documentation:
# sphinx-build -b html . _build/html

view raw JSON →