Skip to content

Latest commit

 

History

History
158 lines (94 loc) · 4.28 KB

diagrams.org

File metadata and controls

158 lines (94 loc) · 4.28 KB

Diagrams

Showing Images

Links to local files, when exported will show up as images in your document. You can also see those images right in sublime.

Org Show Images

Will show all the images in your document in inline popup phantoms right in your document.

images/diagrams_image_links.gif

Creating Diagrams

Src blocks can be used for things other than pure code. For instance, they can be used to make diagrams!

Org Mode has support for some different ways of making diagrams. That said, we currently only support ditaa, graphviz, and plantuml. I only ever really used graphviz, ditaa and plantuml and I find ditaa is MUCH less useful if you don’t have the emacs picture mode or artist mode to help you draw text diagrams in the first place.

Lets look at plantuml diagrams first. I am not going to go into depth on what you can do with plantuml. It is a powerful tool, I recommend you read their website:

I believe on mac it can be installed using homebrew

brew install plantuml
  1. You first need to have plantuml.jar somewhere useful
  2. You also need a copy of the java runtime environment and it HAS to be in your path
  3. In addition once you install those you should restart sublime, so sublime has your lastest path.
  4. Now tell OrgExtended where you have put plantuml.jar
"plantuml": "C:\\path\\plantuml.jar",

Now make a plantuml block like so:

title Authentication Sequence2

Alice->Bob: Hello Request
note right of Bob: Bob thinks about it
Bob->Alice: Authentication Response
  • Save your file!
  • Execute the block!

    images/plantuml1.png

Here I am telling plantuml to generate the image for this into my current directory images folder and to generate a png for me. To run this, put your cursor no plantuml and run:

Org Exec Source Block

images/diagrams_plantuml.gif

Graphviz

Graphviz is a great tool for visualizing networks of data. It comes with quite a few visualization engines. The default is dot.exe.

I believe on mac it can be installed using homebrew. That said, when I tried it I found that graphviz seemed to depend on everything, even the kitchen sink on mac.

brew install graphviz

Again, you need to specify your graphviz path. Please specify the full path to dot.exe. That is considered the default engine.

"graphviz": "<pathtodot>/dot.exe",

Much like plantuml you create a graphviz block, specify your output image, save your view, put your cursor over graphviz and execute the block.

digraph G {
  a -> b;
  a -> c;
  c -> d
} 

images/graphviz.png

There are 2 additional parameters that can be specified:

engine
neato, dot etc. These are the actual tools that ship with graphviz (the layout engine)
fmt
jpg, ps, png - these are the -T option on the tool, read the graphviz docs for more information

Ditaa

Ditaa is a tool for converting ascii art diagrams into images. Emacs makes ditaa particularly useful with its artist and picture modes. We do not have those yet in sublime, but, some day perhaps.

Add the path to ditaa.jar from sourceforge in your settings file:

  • Ditta Homepage
    "ditaa": "<pathto>/ditaa.jar",   
        

    Much like plantuml you must have java.exe (the jre) in your path.

    Create a source block with your diagram.

    +--------+       +----------+
    | Hello  | ----> | Hello2   |
    +--------+       +----------+
        

Save your view, Execute the block and you should now have a diagram!

images/ditaa.png