lang/org: add inline base64/http(s) image support

Adds inline image preview support for http/https links, as well as
base64 encode image support with the img protocol. e.g.

Examples:
[[http://domain.com/some/image.png]]
[[https://raw.githubusercontent.com/hlissner/doom-emacs/screenshots/company.png]]
[[img:iVBORw0KGgoAAAANSUhEUgAAACUAAAAuCAAAAACKMo8cAA...]]
This commit is contained in:
Henrik Lissner 2018-10-17 16:17:36 -04:00
parent fda4734164
commit 99b7b7f740
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 28 additions and 3 deletions

View file

@ -119,8 +119,10 @@ If on a:
(org-toggle-latex-fragment))
(`link
(let ((path (org-element-property :path (org-element-lineage context '(link) t))))
(if (and path (image-type-from-file-name path))
(let* ((lineage (org-element-lineage context '(link) t))
(path (org-element-property :path lineage)))
(if (or (equal (org-element-property :type lineage) "img")
(and path (image-type-from-file-name path)))
(+org/refresh-inline-images)
(org-open-at-point))))