Show HN: Use tl;draw inside Org-mode

lr01 pts0 comments

GitHub - larrasket/org-draw: Drawing into Org-mode using tl;draw on a web browser. Supports drawing from remote devices · GitHub

/" data-turbo-transient="true" />

Skip to content

Search/

Sign in<br>Sign upAppearance settings

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

larrasket

org-draw

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star<br>24

master

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>20 Commits<br>20 Commits

figures

figures

tests

tests

web

web

.gitignore

.gitignore

LICENSE

LICENSE

Makefile

Makefile

README.org

README.org

org-draw.el

org-draw.el

View all files

Repository files navigation

org-draw

Seamless drawing into org-mode.

org-draw lets you draw inside Org-mode using any device with a web browser and have the<br>result land in org-mode buffer as an inline, re-editable, portable figure.

Get started

Add to MELPA

straight.el + use-package

(use-package org-draw<br>:straight (org-draw :type git :host github :repo "larrasket/org-draw"<br>:files ("*.el" ("web" "web/canvas.html")))<br>:commands (org-draw org-draw-edit org-draw-setup))

Doom Emacs

In ~/.doom.d/packages.el:

(package! org-draw<br>:recipe (:host github :repo "larrasket/org-draw"<br>:files ("*.el" ("web" "web/canvas.html"))))

In ~/.doom.d/config.el:

(use-package! org-draw<br>:commands (org-draw org-draw-edit org-draw-setup))

elpaca + use-package

(use-package org-draw<br>:ensure (:host github :repo "larrasket/org-draw"<br>:files ("*.el" ("web" "web/canvas.html")))<br>:commands (org-draw org-draw-edit org-draw-setup))

Usage

M-x org-draw copies the<br>receiver URL to your clipboard. Open it on your machine or any device in your network.

If other people share your network and you don’t want them reaching the server, set<br>org-draw-require-pairing to non-nil. Then the page shows a code-entry screen and<br>org-draw-setup prints a single-use 6-digit code to type in (it expires after 5 wrong<br>attempts).

The drawing surface is tldraw. tldraw is loaded from a CDN, the device needs internet<br>access the first time it opens the page (on an offline network the page shows a clear<br>message instead of a blank screen).

Customization

org-draw-port (default 8777)

org-draw-directory (default "figures")

org-draw-file-name-function (default org-draw-default-file-name)

org-draw-insert-attr-width (default nil) when set to an integer pixel<br>width, org-draw inserts a #+ATTR_ORG: :width N line above the link to a<br>newly created figure, so it displays at a fixed width inline. Leave it nil<br>to skip the ATTR line entirely.

org-draw-require-pairing (default nil) whether a browser must enter a<br>6-digit code before it can draw. Off by default (any browser on your LAN can<br>receive drawings). Set to non-nil on a shared network to require pairing.

org-draw-token-file (default /org-draw-tokens) where<br>paired-device tokens are stored (only used when org-draw-require-pairing is on)

org-draw-figure-background (default transparent) the background baked<br>behind a figure’s ink in the exported PNG. transparent keeps true ink<br>colors and shows the figure against your org buffer’s background (so a white<br>pen shows in a dark theme and a black pen in a light theme); or set it to<br>white, dark, or a CSS color string to bake that behind every figure.

org-draw-web-canvas-file path to the web canvas HTML served at /canvas<br>(defaults to web/canvas.html shipped with the package).

org-draw-open-browser (default nil) when non-nil, org-draw and<br>org-draw-edit open the canvas in a browser on the machine running Emacs (via<br>browse-url), so you can draw right there instead of on another device.

org-draw-copy-url (default t) copy the receiver URL to the kill-ring on<br>org-draw-setup and on the first org-draw of a session. Set to nil to<br>stop copying; the URL is still echoed and listed in the setup buffer.

org-draw-web-open-function (default nil) a custom opener for the per-session<br>/canvas URL; takes precedence over org-draw-open-browser. Set it to a<br>function (e.g. one that targets a specific browser); it is called with the URL.

Keybindings

No keys are bound by default. A suggested set for Org buffers:

(with-eval-after-load 'org<br>(define-key org-mode-map (kbd "C-c d d") #'org-draw)<br>(define-key org-mode-map (kbd "C-c d e") #'org-draw-edit)<br>(define-key org-mode-map (kbd "C-c d s") #'org-draw-setup))

Or with use-package:

(use-package org-draw<br>:bind (:map org-mode-map<br>("C-c d d" . org-draw)<br>("C-c d e" . org-draw-edit)<br>("C-c d s" . org-draw-setup)))

License

GPL-3.0-or-later. See LICENSE.

About<br>Drawing into Org-mode using tl;draw on a web browser. Supports drawing from remote devices<br>Topics<br>emacsipadstylus<br>Resources<br>Readme<br>GPL-3.0 license<br>Activity<br>Stars<br>24...

draw default mode browser package canvas

Related Articles