org-drawio
org-drawio copied to clipboard
Handle drawio in orgmode
- Introduction A small tool to convert .drawio file to .svg file and insert it to orgmode on-the-fly.
You may want to try a more general solution ([[https://github.com/kimim/chatu][https://github.com/kimim/chatu]]) which supports both orgmode and markdown, and drawio, plantuml, clojure, R ...
- Install Before using org-drawio, you may need to install drawio and pdf2svg in your PATH.
From melpa with use-package: #+begin_src emacs-lisp (use-package org-drawio :commands (org-drawio-add org-drawio-open) :custom ((org-drawio-input-dir "./draws") (org-drawio-output-dir "./images") (org-drawio-output-page "0") ;; set to t, if you want to crop the image. (org-drawio-crop nil))) #+end_src
Or git submodule and use-package #+begin_src emacs-lisp (use-package org-drawio :load-path "~/.emacs.d/site-lisp/org-drawio" :commands (org-drawio-add org-drawio-open) :custom ((org-drawio-input-dir "./draws") (org-drawio-output-dir "./images") (org-drawio-output-page "0") ;; set to t, if you want to crop the image. (org-drawio-crop nil))) #+end_src
- Usage Move cursor to =#+drawio= line, and invoke ~org-drawio-add~ to add image, ~org-drawio-open~ to open original .drawio file.
Remind!
- the .drawio file should be the first parameter.
- in order to support whitespace in file and dir name, please "quote all of them".
#+begin_src org #+drawio: "diagram.drawio" #+end_src or omit the extension .drawio #+begin_src org #+drawio: "diagram" #+end_src #+drawio: "diagram" #+name: workflow #+caption: org-drawio workflow [[file:./images/diagram-0.svg]]
It is also possible to extract specific page.
#+begin_src org #+drawio: "diagram.drawio" :page 1 #+end_src #+drawio: "diagram.drawio" :page 1 [[file:./images/diagram-1.svg]]
Even more specific about input-dir, output-dir and output file name:
#+begin_src org #+drawio: "diagram.drawio" :page 0 :input-dir "./draws" :output-dir "./images" :output "diagram.svg" #+end_src #+drawio: "diagram.drawio" :page 0 :input-dir "./draws" :output-dir "./images" :output "diagram.svg" [[file:./images/diagram.svg]]