• Stars
    star
    108
  • Rank 321,259 (Top 7 %)
  • Language
    Python
  • License
    BSD 2-Clause "Sim...
  • Created about 7 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PlantUML for Sphinx

Installation

pip install sphinxcontrib-plantuml

Usage

Add sphinxcontrib.plantuml to your extensions list in your conf.py:

extensions = [
    'sphinxcontrib.plantuml',
]

You may also need to specify the plantuml command in your conf.py:

plantuml = 'java -jar /path/to/plantuml.jar'

Instead, you can install a wrapper script in your PATH:

% cat <<EOT > /usr/local/bin/plantuml
#!/bin/sh -e
java -jar /path/to/plantuml.jar "$@"
EOT
% chmod +x /usr/local/bin/plantuml

Then, write PlantUML text under the .. uml:: directive:

.. uml::

   Alice -> Bob: Hi!
   Alice <- Bob: How are you?

or specify path to an external PlantUML file:

.. uml:: external.uml

You can specify height, width, scale and align:

.. uml::
   :scale: 50 %
   :align: center

   Foo <|-- Bar

You can also specify a caption:

.. uml::
   :caption: Caption with **bold** and *italic*
   :width: 50mm

   Foo <|-- Bar

For details, please see PlantUML documentation.

Configuration

plantuml
Path to plantuml executable. (default: 'plantuml')
plantuml_output_format

Type of output image for HTML renderer. (default: 'png')

png:generate only .png inside </img>
svg:generate .svg inside <object/> with .png inside </img> as a fallback
svg_img:generate only .svg inside <img/> (browser support)
svg_obj:generate only .svg inside <object/> (browser support)
none:do not generate any images (ignore uml directive)

When svg is inside <object/> it will always render full size, possibly bigger than the container. When svg is inside <img/> it will respect container size and scale if necessary.

plantuml_latex_output_format

Type of output image for LaTeX renderer. (default: 'png')

eps:generate .eps (not supported by pdflatex)
pdf:generate .eps and convert it to .pdf (requires epstopdf)
png:generate .png
tikz:generate .latex in the TikZ format
none:do not generate any images (ignore uml directive)

Because embedded png looks pretty bad, it is recommended to choose pdf for pdflatex or eps for platex.

plantuml_epstopdf
Path to epstopdf executable. (default: 'epstopdf')
plantuml_syntax_error_image
Should plantuml generate images with render errors. (default: False)
plantuml_cache_path
Directory where image cache is stored. (default: '_plantuml')
plantuml_batch_size

(EXPERIMENTAL) Run plantuml command per the specified number of images. (default: 1)

If enabled, plantuml documents will be first written to the cache directory, and rendered in batches. This eliminates bootstrapping overhead of Java runtime and allows plantuml to leverage multiple CPU cores.

To enable batch rendering, set the size to 100-1000.

Developing

Install the python test dependencies with

pip install sphinxcontrib-plantuml[test]

In addition the following non-python dependencies are required in order to run the tests:

  • latexmk
  • plantuml
  • texlive
  • texlive-font-utils
  • texlive-latex-extra

The tests can be executed using pytest

pytest

More Repositories

1

confluencebuilder

Confluence Markup Builder Plugin for Sphinx
Python
312
star
2

napoleon

Python
149
star
3

sphinxcontrib-versioning

Sphinx extension that allows building versioned docs for self-hosting.
Python
125
star
4

openapi

OpenAPI (fka Swagger) spec renderer for Sphinx.
Python
109
star
5

spelling

A spelling checker for Sphinx-based documentation
Python
81
star
6

sphinx-lint

Check for stylistic and formal issues in .rst and .py files included in the documentation
Python
68
star
7

matlabdomain

A Sphinx extension for documenting Matlab code
Python
61
star
8

httpdomain

Documenting RESTful HTTP APIs
Python
59
star
9

apidoc

A Sphinx extension for running sphinx-apidoc on each build
Python
53
star
10

youtube

A Sphinx extension to embed videos from YouTube
Python
51
star
11

emojicodes

An extension to use emoji codes in your Sphinx documentation! 😍
Python
48
star
12

video

A sphinx plugin that enables embedding of HTML5 videos
Python
45
star
13

autoprogram

Documenting CLI programs
Python
44
star
14

datatemplates

Sphinx plugin for generating RST on the fly from data files and templates.
Python
44
star
15

fulltoc

Extension for Sphinx to make the sidebar show a full table of contents instead of just the local headings
Python
38
star
16

kroki

Embed PlantUML, DOT, etc. diagrams in your documentation using Kroki.
Python
36
star
17

redoc

ReDoc powered OpenAPI (fka Swagger) spec renderer for Sphinx.
Python
33
star
18

restbuilder

A Sphinx builder/writer to output reStructuredText (rst) files
Python
31
star
19

cookiecutter

A cookiecutter template for a Sphinx extension
Python
24
star
20

sphinx-pretty-searchresults

Sphinx: pretty search results is an extension for the Sphinx documentation tool. To display search results, Sphinx is fetching the source files of search hits and rendering excerpts in raw markup. This extension removes the markup from these source files (during build time), so the search results look decent.
Python
22
star
21

googleanalytics

Python
18
star
22

sphinxcontrib-towncrier

An RST directive for injecting a Towncrier-generated changelog draft containing fragments for the unreleased (next) project version. Demo: https://ansible-pylibssh.rtfd.io/changelog. Docs: https://sphinxcontrib-towncrier.rtfd.io
Python
17
star
23

tikz

A Sphinx extension to draw pictures with the TikZ/PGF LaTeX package
Python
16
star
24

doxylink

A Sphinx extension to link to external Doxygen API documentation.
Python
15
star
25

prefectviz

An extension to add Prefect flow visualizations into you Sphinx documentation.
Python
14
star
26

github-administration

This repository is used for managing the sphinx-contrib GitHub organization, including requesting importing new repositories or granting permissions.
13
star
27

svgbob

A Sphinx extension to convert ASCII diagrams to SVGs with Svgbob.
Python
12
star
28

jquery

Extension to include jQuery on newer Sphinx releases
Python
10
star
29

redirects

A Sphinx extension for generating JavaScript-driven redirects for moved pages
Python
9
star
30

typer

Auto generate docs for typer and click commands using typer's rich console formatting.
Python
9
star
31

sqltable

Python
7
star
32

scm

Sphinx SCM interface
Python
7
star
33

email

Python
6
star
34

sphinxcontrib-details-directive

Python
5
star
35

slide

A Sphinx extension to embed presentation slides on Slideshare and other sites
Python
5
star
36

prefecttask

An extension to autodoc Prefect Tasks
Python
5
star
37

icon

custom sphinx role to embed inline icons
Python
5
star
38

sadisplay

A Sphinx extension for displaying SqlAlchemy model
Python
5
star
39

prettyspecialmethods

Shows special/magic methods in sphinx docs as the python syntax that invokes them
Python
5
star
40

pecanwsme

Extension to Sphinx for documenting APIs built with Pecan and WSME
Python
5
star
41

ogp

Sphinx OGP feature for html builder
Python
4
star
42

examplecode

Python
4
star
43

proof

∎ A Sphinx extension to provide directives to typeset theorems, properties, proofs, etc.
Python
4
star
44

exceltable

Python
4
star
45

documentedlist

DocumentedList Sphinx Extension
Python
4
star
46

stuffcounter

A sphinx extension to illustrate the `add_enumerable_node()` method.
Python
4
star
47

cheader

Sphinx extension that implements a c:header directive.
Python
4
star
48

inlinesyntaxhighlight

Python
3
star
49

mscgen

Python
2
star
50

sqlalchemyviz

SqlAlchemyViz Sphinx Extension
Python
2
star
51

feed

Python
2
star
52

cmakedomain

Python
2
star
53

gherkin

Sphinx parser for Gherkin BDD
Shell
2
star
54

googlechart

Python
2
star
55

ansi

💖 Project is looking for extra maintainers, check issue tracker.
Python
2
star
56

requirements

A Sphinx extension that lets you declare requirements wherever you need (e.g. in test docstrings), mark statuses and collect them in a single list
Python
2
star
57

sdedit

A Sphinx extension for inserting sequence diagram by using Quick Sequence Diagram Editor
Python
2
star
58

sword

A Sphinx extension for inserting Bible verses from Sword
Python
2
star
59

autofile

A sphinx extension to generate module for many files from a glob expression. maintainers: @Freed-Wu
Python
2
star
60

packages

📦 Provide directives to display packages installed on the host machine.
Python
2
star
61

findanything

JavaScript
1
star
62

cheeseshop

Python
1
star
63

gnuplot

Python
1
star
64

autoanysrc

Python
1
star
65

gravizo

Embed PlantUML, DOT, etc. diagrams in your documentation using Gravizo.
Python
1
star
66

eval

Evaluate shell command or python code in sphinx and myst.
Python
1
star
67

lilypond

Python
1
star
68

clearquest

Python
1
star
69

whooshindex

A Sphinx whoosh indexer extension
Python
1
star
70

imagesvg

Python
1
star
71

aafig

Sphinx extension to add ASCII-art diagrams using aafigure
Python
1
star
72

zopeext

A Sphinx extension that provides an 'autointerface' directive for using Zope interfaces
Python
1
star
73

cacoo

Python
1
star
74

googlemaps

Python
1
star
75

autorun

Python
1
star
76

rubydomain

A Sphinx extension for Ruby support (Sphinx 1.0 needed)
Python
1
star
77

domaintools

Python
1
star
78

btn

A sphinx custom role to embed inline btn
Python
1
star
79

sphinxcontrib-skeleton

The automatic build of the @sphinx-contrib/copier-sphinxcontrib template
Python
1
star
80

copier-sphinxcontrib

The skeleton of a sphinxcontrib extention
Jinja
1
star
81

sphinxcontrib-termynal

Sphinx extension to include termynal windows in html documentation build.
Python
1
star