From: Christian Moe <mail@christianmoe.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org, gerard.vermeulen@posteo.net,
Timothy <orgmode@tec.tecosaur.net>
Subject: Re: [PATCH] ox-html.el: add option to embed SVG for CSS support in SVG
Date: Wed, 07 Jun 2023 16:30:01 +0200 [thread overview]
Message-ID: <87h6rjqr9y.fsf@christianmoe.com> (raw)
In-Reply-To: <87cz27eka4.fsf@localhost>
Ihor Radchenko writes:
> Christian Moe <mail@christianmoe.com> writes:
>
>> I think there's a better approach. Tl;dr:
>>
>> - A better way to have active CSS in SVG images is to link to the
>> external SVG file with the <object> rather than <img> tag, as we used
>> to.
>
> Reading the linked threads, it seems that <object> has its own
> downsides. Why is it strictly better then?
I'm not sure it's strictly better.
The problem in the linked threads was with scaling, and I don't think it
applies anymore. As I just tested in Firefox, at least, I can control
the size of Gerard's SVG illustration perfectly well by setting CSS
height and width attributes on an <object>.
Apart from that, my reasoning amounted only to this:
- <object> works as well as embedding for CSS
- For Org to extract and embed the SVG means more things that can break
(though I admit that it can be made a lot less fragile than the
#+INCLUDE hack) and when they do break, it's an Org problem. With
<object> Org just needs to properly format the tags; if it does, the
rest is the browser's responsibility.
- If the external SVG file is modified, with embedding all files
referencing it need to be exported again for the change to take
effect. With <object> linking to the external file, all that is
needed is refreshing the browser.
- Readable, uncluttered HTML is nice; huge, unreadable stretches of SVG
aren't.
Some arguments for embedding I didn't consider:
- fewer http calls
- It makes accessing the SVG internals with Javascript a bit easier than
with <object> (the difference is just one line of JS) -- and a lot
easier if you trigger Firefox's same-origin restrictions by keeping
the files on a file system rather than a server.
>> - Without patching Org, you can embed an external SVG file as an SVG
>> island in Org HTML export simply by using #+INCLUDE.
>
> To be clear, I am in favor of adding "embedding" switch for ox-html in
> general. It is a feature several people requested elsewhere - for all images.
> #+INCLUDE is cumbersome, does not work with captions, and will generally
> break Org customization relying on Org knowing what kind of object is
> being exported.
Fair points.
Yours,
Christian
next prev parent reply other threads:[~2023-06-07 14:31 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 13:23 [PATCH] ox-html.el: add option to embed SVG for CSS support in SVG gerard.vermeulen
2023-06-06 7:49 ` Ihor Radchenko
2023-06-06 9:57 ` Christian Moe
2023-06-06 13:37 ` gerard.vermeulen
2023-06-06 18:54 ` Christian Moe
2023-06-07 8:43 ` Ihor Radchenko
2023-06-07 8:41 ` Ihor Radchenko
2023-06-07 14:30 ` Christian Moe [this message]
2023-06-07 17:57 ` Ihor Radchenko
2023-06-15 13:09 ` gerard.vermeulen
2023-06-15 14:55 ` Max Nikulin
2023-06-15 20:42 ` Ihor Radchenko
2023-06-15 20:51 ` Ihor Radchenko
2023-06-16 18:39 ` gerard.vermeulen
2023-06-17 12:38 ` Ihor Radchenko
2023-06-17 14:45 ` gerard.vermeulen
2023-06-21 15:52 ` Max Nikulin
2023-06-21 16:02 ` Ihor Radchenko
2023-06-21 16:27 ` Max Nikulin
2023-06-21 16:38 ` Ihor Radchenko
2023-06-22 16:25 ` Max Nikulin
2023-06-23 11:02 ` Ihor Radchenko
2023-06-06 12:58 ` gerard.vermeulen
2023-06-07 9:07 ` Ihor Radchenko
2023-06-06 14:14 ` Max Nikulin
2023-06-06 16:08 ` gerard.vermeulen
2023-06-07 9:10 ` Ihor Radchenko
2023-06-09 15:27 ` Max Nikulin
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h6rjqr9y.fsf@christianmoe.com \
--to=mail@christianmoe.com \
--cc=emacs-orgmode@gnu.org \
--cc=gerard.vermeulen@posteo.net \
--cc=orgmode@tec.tecosaur.net \
--cc=yantar92@posteo.net \
/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 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).