Diagrams from code #
I really like the idea of generating diagrams from code.
PlantUML is a nice way to draw class diagrams from plain text, for example:
skinparam monochrome true Person <|-- Man Person <|-- Woman Person : name Person : getPhoneNumber() Woman : dress Man : trousers
You need to
brew install graphviz
You need to download the PlantUML JAR from this site
You need to place this JAR in a location of your choice and set
(setq org-plantuml-jar-path ( expand-file-name "/Users/clinton/.emacs.d/plantuml.jar"))
First install Mermaid using
npm, the node package manager (which you can install with
brew if you dont have it). Tested on an M1 MacBook Air running MacOS Big Sur.
brew install npm npm install -g mermaid.cli
And then run
M-x package-install ob-mermaid and in your
init.el add lines
(use-package ob-mermaid) (setq ob-mermaid-cli-path "/opt/homebrew/bin/mmdc")
Now you can generate nice diagrams:
sequenceDiagram A-->B: Works!