Would the HTML <svg> tag be appropriate in this case? For example, here's a tiny example of using the <svg> tag with an external CSS stylesheet: https://plnkr.co/edit/i8RFDW?preview
On Fri, Oct 14, 2022 at 4:32 AM Ihor Radchenko <yanta...@gmail.com> wrote: > Alexandre Duret-Lutz <a...@lrde.epita.fr> writes: > > > In Org 9.5, SVG images started being exported by the HTML exporter as > > <img> rather than <object>. > > > > The patch causing that was > > https://list.orgmode.org/87k0pemj6d....@gmail.com/T/ > > with two arguments: > > 1) <object> do not have an alt attribute > > 2) <object> will not render some SVG file correctly if it has no viewBox > > (I'm assuming that the issue shown in that message is a missing > viewBox). > > > > The reason I've noticed this change is that it broke my web pages. On > > my pages, I use SVG to display many automata, and they all share a > > common stylesheet. That stylesheet is not inlined into the SVG, rather, > > it is a separate file included in the SVG files with > > <?xml-stylesheet href="filename.css" type="text/css"?> > > so that the browser only need to download it once. > > > > Infortunately, <img> does not allow external stylesheets to be > > processed, so my stylesheets are now ignored. Note that one can also > > build SVG images that include other SVG images, or SVG images that have > > animations that start when you hover on some elements. All those > > usages would break with <img>. > > > > I've seen that very issue was discussed back in 2016 > > https://list.orgmode.org/871t2iq353....@iki.fi/T/ > > where Christian Moe pointed out exactly this: > > > >> (2) You can also do other things with <object> that you cannot with > >> <img>, like manipulating the SVG with Javascript and styling it with > >> an external stylesheet (linked from the SVG, not the web page). > > > > So in the interest of allowing users to build documents where SVG > > files are not static, self-contained images, it seems to me that Org > > probably needs some way to specify whether SVG images should be > > exported as <img> or <object> (or maybe even inlined). > > Confirmed. > This is clearly a regression and should be fixed. > > -- > 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> > >