2016-01-25 10:06:16 +00:00
#+TITLE : plantuml layer
2018-07-10 10:57:25 +00:00
2019-05-07 08:21:07 +00:00
#+TAGS : dsl|layer|markup|programming
2019-05-05 17:26:40 +00:00
2016-01-25 10:06:16 +00:00
[[file:img/logo.png ]]
2016-04-13 03:31:38 +00:00
2019-05-07 20:05:06 +00:00
* Table of Contents :TOC_5_gh:noexport:
2017-05-22 14:16:12 +00:00
- [[#description ][Description ]]
2017-09-03 18:42:17 +00:00
- [[#features ][Features: ]]
2017-05-22 14:16:12 +00:00
- [[#install ][Install ]]
- [[#org-babel-integration ][Org-Babel Integration ]]
- [[#key-bindings ][Key bindings ]]
2016-01-25 10:06:16 +00:00
* Description
2016-10-16 15:36:58 +00:00
This layer enables support for [[https://github.com/skuro/plantuml-mode ][plantuml-mode ]], which provides
2016-01-25 10:06:16 +00:00
a major-mode for [[http://plantuml.com ][plantuml ]]. PlantUML is a tool to generate [[https://en.wikipedia.org/wiki/Unified_Modeling_Language ][UML diagrams ]] from plain-text.
2020-02-15 01:32:36 +00:00
For help with how to use plantuml, see the [[http://plantuml.com ][plantuml website ]] and the [[http://plantuml.com/guide ][reference guide ]].
2016-01-25 10:06:16 +00:00
The official file extension supported by this layer is =.pum= . If you want something else,
set it in your =user-config= function of your =~/.spacemacs= file.
For example, the following diagram can be defined as follows:
#+BEGIN_SRC plantuml
2018-09-19 03:54:47 +00:00
@startuml
JAremko->robbyoconnor : I think the docs can benefit from some kind of illustration
JAremko<-robbyoconnor : I'm too lazy -- I have actual work to do. I link to the docs. If you can write me a diagram in plantuml, I'll gladly compile and add it.
JAremko->robbyoconnor : *gives ths diagram*
robbyoconnor<-JAremko : *robbyoconnor adds it and JAremko is happy*
...
robbyoconnor->theOtherPerson : And they thinks it's funny? Yup, they definitely finds it funny. Right?
@enduml
2016-01-25 10:06:16 +00:00
#+END_SRC
[[file:img/dia.png ]]
2017-09-03 18:42:17 +00:00
** Features:
2018-02-01 20:25:36 +00:00
- Syntax highlighting
- Diagram preview in various output formats
- Embedding into org documents
- Controlling the =Plantuml= compiler directly from emacs
2017-09-03 18:42:17 +00:00
2016-01-25 10:06:16 +00:00
* Install
To use this contribution add it to your =~/.spacemacs=
2018-09-19 03:54:47 +00:00
#+BEGIN_SRC emacs-lisp
2016-01-25 10:06:16 +00:00
(setq-default dotspacemacs-configuration-layers '(plantuml))
2018-09-19 03:54:47 +00:00
#+END_SRC
2016-01-25 10:06:16 +00:00
2018-02-01 20:25:36 +00:00
To control the =Plantuml= compiler you also need to download the [[http://plantuml.com/download ][Plantuml jar ]]
and configure the =plantuml-jar-path= respectively:
2018-09-19 03:54:47 +00:00
#+BEGIN_SRC emacs-lisp
2018-02-01 20:25:36 +00:00
(setq-default dotspacemacs-configuration-layers '((plantuml :variables plantuml-jar-path "~/plantUml.jar")))
2018-09-19 03:54:47 +00:00
#+END_SRC
2018-02-01 20:25:36 +00:00
To get the full range of =Plantuml= compilations working, you will also need
the native package [[http://graphviz.org/ ][graphviz ]] installed on your system.
2020-05-16 10:31:28 +00:00
If you don't want to compile locally you can set =plantuml-exec-mode= to =server= .
This will make plantuml try to use an online compile server. Be warned these resources
change often and plantuml-mode is not always up-to-date. For a stable user experience
we recommend using the default jar option instead.
2019-10-03 13:28:45 +00:00
#+BEGIN_SRC emacs-lisp
2020-05-16 10:31:28 +00:00
(setq-default dotspacemacs-configuration-layers '((plantuml :variables plantuml-default-exec-mode 'server)))
2019-10-03 13:28:45 +00:00
#+END_SRC
2016-02-08 21:31:53 +00:00
* Org-Babel Integration
To enable the execution of embedded plantuml code blocks within [[http://orgmode.org/ ][Org-Mode ]]
2018-02-01 20:25:36 +00:00
documents, define a value for =org-plantuml-jar-path= in your =~/.spacemacs= :
2018-09-19 03:54:47 +00:00
#+BEGIN_SRC emacs-lisp
2020-05-16 10:31:28 +00:00
(setq-default dotspacemacs-configuration-layers '((plantuml :variables plantuml-jar-path "~/plantUml.jar" org-plantuml-jar-path "~ /plantUml.jar")))
2018-09-19 03:54:47 +00:00
#+END_SRC
2016-02-08 21:31:53 +00:00
2016-01-25 10:06:16 +00:00
* Key bindings
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2016-01-25 10:06:16 +00:00
|--------------------------+-------------------------------------------------------|
| ~SPC m c c~ or ~C-c C-c~ | Build diagram from the text in the current buffer |
2016-11-22 20:53:50 +00:00
| ~SPC m c o~ | Set the output type (=unicode text=, =svg=, or =png=) |