plantuml-mode supports execution using a PlantUML server, with (setq plantuml-default-exec-mode 'server). I can set the server location with (setq plantuml-server-url "https://myserver.plantuml.com").

However, as far as I can tell, I cannot use a remote PlantUML Server for executing Org Babel blocks with PlantUML source? It seems to require a local .jar file defined in org-plantuml-jar-path. Can I simply pass a remote URL to this variable to get Org Mode to work the same as PlantUML Mode?

1 Answer 1


I'm not using plantuml-mode, but have used plantuml with Org babel blocks. I'm currently using this setup to use the Plantuml server to render images on GitHub. You may be able to modify to work locally, which could be useful now that a recent Org mode supports rendering remote (HTTP) images.

I'm currently generating the PlantUML source with a Python Babel block like this:

#+NAME: plantuml
#+BEGIN_SRC python :file plantuml.out :post plantuml_url :results output raw file drawer
print("Bob -> Alice : hello")

(I'm actually using :var foo to bring in some output from another code block which I then parse with Python to generate a more complicated diagram).

Anyway, the plantuml_url block, called via the :post header arg is:

#+NAME: plantuml_url
#+BEGIN_SRC bash :exports results :results raw drawer
url=$(java -jar ~/local/src/plantuml.jar -encodeurl ~/path/to/plantuml.out)
echo "#+BEGIN_HTML"
echo "<img src=http://www.plantuml.com/plantuml/png/${url}>"
echo "#+END_HTML"

Which takes the valid PlantUML source in a file generated by the first (Python) block (see :file), uses plantuml to get the encoded URL, and then spits out some wrapper #+BEGIN_HTML and #+END_HTML so that GitHub will properly display the HTML img.

I don't run this plantuml_url bash block - I run the Python plantuml block, and it calls plantuml_url (via :post). The Python block results look like this:

#+RESULTS: plantuml
<img src=http://www.plantuml.com/plantuml/png/SoWkIImgAStDuNBAJrBGjLDmpCbCJbMmKiX8pSd9vt98pKi1IW80>

If you drop the code immediately above into GitHub README.org you won't see anything because it's a RESULTS block, and you need a code block above it with :exports both or :exports results to override the default which is :exports code. Or remove the #+RESULTS: line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.