A small tool to convert .drawio file to .svg file and insert it to orgmode on-the-fly.
Before using org-drawio, you may need to install drawio and pdf2svg in your PATH.
From melpa with use-package:
(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)))
Or git submodule and use-package
(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)))
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.
#+drawio: diagram.drawio
or omit the extension .drawio
#+drawio: diagram
It is also possible to extract specific page.
#+drawio: diagram.drawio :page 1
Even more specific about input-dir, output-dir and output file name:
#+drawio: diagram.drawio :page 0 :input-dir ./draws :output-dir ./images :output diagram.svg