A PlantUML plugin for Markdown
Project description
PlantUML Extension for Python-Markdown
This plugin implements a block extension which can be used to specify a PlantUML diagram which will be converted into an image and inserted in the document.
Syntax:
::uml:: [format="png|svg|txt"] [classes="class1 class2 ..."] [alt="text for alt"] [title="Text for title"]
PlantUML script diagram
::end-uml::
Example:
::uml:: format="png" classes="uml myDiagram" alt="My super diagram placeholder" title="My super diagram"
Goofy -> MickeyMouse: calls
Goofy <-- MickeyMouse: responds
::end-uml::
The GitLab/GitHub block syntax is also recognized. Example:
```plantuml format="png" classes="uml myDiagram" alt="My super diagram placeholder" title="My super diagram"
Goofy -> MickeyMouse: calls
Goofy <-- MickeyMouse: responds
```
Options are optional, but if present must be specified in the order format, classes, alt, title.
The option value may be enclosed in single or double quotes.
Installation
You need to install PlantUML (see the site for details) and Graphviz 2.26.3 or later.
The plugin expects a program plantuml in the classpath. If not installed by your package
manager, you can create a shell script and place it somewhere in the classpath. For example,
save te following into /usr/local/bin/plantuml (supposing PlantUML installed into
/opt/plantuml):
#!/bin/bash
java -jar /opt/plantuml/plantuml.jar ${@}
For Gentoo Linux there is an ebuild at http://gpo.zugaina.org/dev-util/plantuml/RDep: you can download
the ebuild and the files subfolder or you can add the zugaina repository with layman
(reccomended).
To use the plugin with Python-Markdown you have two choices:
-
copy the file
plantuml.pyin theextensionsfolder of Python-Markdown. For example, for Python 2.7 you must do:$ sudo cp plantuml.py /usr/lib/python27/site-packages/markdown/extensions/
-
copy the file somewhere in your home. A good choice may be the
user-sitepath, for example (bashsyntax):$ export INSTALLPATH="`python -m site --user-site`/plantuml-markdown" $ mkdir -p "$INSTALLPATH" $ cp plantuml.py "$INSTALLPATH/mdx_plantuml.py" $ export PYTHONPATH="$INSTALLPATH"
You must export
PYTHONPATHbefore runningmarkdown_py, or you can put the definition in~/.bashrc.
After installed, you can use this plugin by activating it in the markdownm_py command. For example:
markdown_py -x plantuml mydoc.md > out.html
Running tests
The test execution requires a specific version of PlantUML (the image generated can be different with different PlantUML versions).
To run the tests, execute the following command:
PATH="$PATH:$PWD/test" python -m unittest discover -v -s test
This command uses a custom version of the plantuml command which will download the expected version of PlantUML for
tests execution without clobbering the system.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file plantuml_markdown-1.2.3-py3-none-any.whl.
File metadata
- Download URL: plantuml_markdown-1.2.3-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a57e426bf05526795f8d40daf4dd60f3d3ba87de9f79f76e2fd201f7a987379
|
|
| MD5 |
7b843e1c5b145fb85d75f0af46e13a99
|
|
| BLAKE2b-256 |
46941b76920e6179b0abe0c030bf4d5b1fcbdde6e8d6f0f08888c3d9e6cc1c86
|