all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jay Kamat <jaygkamat@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: [PATCH] ox-html: Add webp as an inline image format
Date: Mon, 08 Mar 2021 17:30:33 -0800	[thread overview]
Message-ID: <87wnuhxgee.fsf@eve> (raw)

[-- Attachment #1: Type: text/plain, Size: 704 bytes --]

Hi,

By default, ox-html inlines most image links (such as png and jpg). However, 
this is currently not the case for webp.

Webp is a image format introduced in 2010 by Google, which now has widespread 
adoption in mainstream browsers. I personally would like to use it because it 
has much better compression levels than the older alternatives. For more 
information on support levels, this site has a synopsis: 
https://caniuse.com/webp

Since it has widespread adoption and support, I would like to propose adding 
it to the default filetypes ox-html inlines as images. A patch is provided 
below to do this. Let me know if you have any thoughts or suggestions.

Thanks for all your hard work,
-Jay


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-html-Add-webp-as-an-inline-image-format.patch --]
[-- Type: text/x-diff, Size: 1484 bytes --]

From e7385370a9a023a68f123374793bc8d706d5580c Mon Sep 17 00:00:00 2001
From: Jay Kamat <jaygkamat@gmail.com>
Date: Mon, 8 Mar 2021 16:55:37 -0800
Subject: [PATCH] ox-html: Add webp as an inline image format

* lisp/ox-html.el (org-html-inline-image-rules): Add webp as an inline
  image format

Webp is an image format introduced in 2010, which now has widespread
support in browsers. ox-html can inline webp images identically to how
it does already for other image formats.

Signed-off-by: Jay Kamat <jaygkamat@gmail.com>
---
 lisp/ox-html.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 11757bb35..3fa5ef864 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -848,9 +848,9 @@ link to the image."
   :type 'boolean)
 
 (defcustom org-html-inline-image-rules
-  `(("file" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg")))
-    ("http" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg")))
-    ("https" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg"))))
+  `(("file" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg" ".webp")))
+    ("http" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg" ".webp")))
+    ("https" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg" ".webp"))))
   "Rules characterizing image files that can be inlined into HTML.
 A rule consists in an association whose key is the type of link
 to consider, and value is a regexp that will be matched against
-- 
2.20.1


             reply	other threads:[~2021-03-09  1:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09  1:30 Jay Kamat [this message]
2021-03-19  5:14 ` [PATCH] ox-html: Add webp as an inline image format Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wnuhxgee.fsf@eve \
    --to=jaygkamat@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.