emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ox-html: Add webp as an inline image format
@ 2021-03-09  1:30 Jay Kamat
  2021-03-19  5:14 ` Kyle Meyer
  0 siblings, 1 reply; 2+ messages in thread
From: Jay Kamat @ 2021-03-09  1:30 UTC (permalink / raw)
  To: Org Mode

[-- 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ox-html: Add webp as an inline image format
  2021-03-09  1:30 [PATCH] ox-html: Add webp as an inline image format Jay Kamat
@ 2021-03-19  5:14 ` Kyle Meyer
  0 siblings, 0 replies; 2+ messages in thread
From: Kyle Meyer @ 2021-03-19  5:14 UTC (permalink / raw)
  To: Jay Kamat; +Cc: Org Mode

Jay Kamat writes:

> Subject: [PATCH] ox-html: Add webp as an inline image format

Thanks for the patch.  Pushed (a9f38b1c2) with a few additions (updated
the :package-version keyword, added a NEWS entry, and added a period
after the changelog entry.)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-19  5:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-09  1:30 [PATCH] ox-html: Add webp as an inline image format Jay Kamat
2021-03-19  5:14 ` Kyle Meyer

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).