emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ox-html.el: add option to embed SVG for CSS support in SVG


From: Ihor Radchenko
Subject: Re: [PATCH] ox-html.el: add option to embed SVG for CSS support in SVG
Date: Wed, 07 Jun 2023 17:57:15 +0000

Christian Moe <mail@christianmoe.com> writes:

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

That ship sailed long time ago.
Now, switching back to <object> will be a breaking change that should be
justified. Mind that we use "img" tag for all images, not just svg.

For now, you are just pointing that <object> will inherit CSS of the
page.

But there will be downsides you mentioned, like absence of alt
attribute (which is a big deal - we do not want to compromise
accessibility for blind users - see
https://orgmode.org/list/CAJcAo8uTOpEazLNCr0t1kFqPGTLz=G=aDnKLhuo1-Ura8-m7-Q@mail.gmail.com
 or
https://list.orgmode.org/orgmode/87czew3w5l.fsf@localhost/ )
Also, https://www.w3schools.com/TAgs/tag_object.asp explicitly
recommends against <object> for images in favor or <img>.

Finally, I can see that there are ways to use CSS on img+svg:
https://blog.union.io/code/2017/08/10/img-svg-fill/

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

May you elaborate?

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

That's why the proposed patch does not turn the embedding on by default.
But some people do want embedding to make html self-contained, if not
for CSS.

Note that I am inclined to accept the patch for reasons different
from the motivation of the patch author. Especially, if the patch gets
extended to allow embedding raster images as well.

> - Readable, uncluttered HTML is nice; huge, unreadable stretches of SVG
>   aren't.

Sure, if users want uncluttered HTML. Some users do. Some wants the
opposite.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]