Ditaa Code Blocks in Org
Org support for ditaa
Introduction
Ditaa is a command-line utility that converts diagrams drawn using
ASCII art into bitmap graphics.
Requirements and Setup
Ditaa is no longer distributed with Org. Now, you will need to install ditaa and store the path to the executable in the variable ob-ditaa-jar-path. Often, this is all that is needed to set up ditaa in Babel. Nevertheless, Org offers several other variables designed to accommodate non-standard Java setups. These include org-babel-ditaa-java-cmd, org-ditaa-eps-jar-path, and org-ditaa-jar-option.
Activate evaluation of ditaa source code blocks by adding ditaa to
org-babel-load-languages.
(org-babel-do-load-languages 'org-babel-load-languages '((ditaa . t))) ; this line activates ditaa
Babel Features for ditaa Code Blocks
Header Arguments
- file
ditaasource code blocks require that an output file be specified- cmdline
- specify command line arguments for
ditaa - java
- arguments for the
javaruntimes (JRE)
Sessions
ditaa does not support sessions.
Result Types
Ditaa source code blocks return a link to a png bitmap file.
Examples of Use
The obligatory Hello World! example in ditaa:
#+BEGIN_SRC ditaa :file images/hello-world.png +--------------+ | | | Hello World! | | | +--------------+ #+END_SRC
Now, round all corners by passing ditaa the -r,--round-corners
command line switch.
#+BEGIN_SRC ditaa :file images/hello-world-round.png :cmdline -r +--------------+ | | | Hello World! | | | +--------------+ #+END_SRC