Alternative excalidraw integration

Emacs config (I use Doom Emacs)

(after! org
  (org-add-link-type "excalidraw" 'org-excalidraw-open)

  (defun org-excalidraw-open (name)
    "open excalidraw"
    (let* ((excalidraw-appdata-root "~/Dropbox/Appdata/Excalidraw")
           (excalidraw-empty-file (f-join excalidraw-appdata-root ".empty.excalidraw"))
           (excalidraw-path (f-join excalidraw-appdata-root (concat name ".excalidraw")))
           (excalidraw-export-path (f-join excalidraw-appdata-root "Exports" (concat name ".svg"))))
      (unless (f-exists? excalidraw-path) (f-copy excalidraw-empty-file excalidraw-path))
      (quiet! (shell-command (concat "open " (shell-quote-argument excalidraw-path))))
      (message (concat "Openning " excalidraw-path))
      ))
  )

YASnippet for inserting excalidraw link and the image

# key: <ex
# name: Excalidraw
# --
[[file:~/Dropbox/Appdata/Excalidraw/Exports/${1:filename}.svg]]
[[excalidraw:$1]]

CLI for converting .excalidraw to .svg: GitHub - aur3l14no/excalidraw-cli: convert excalidraw file to png / svg file
(font is not rendering correctly right now)

1 Like