From: Günter M. <mi...@us...> - 2023-11-14 17:01:40
|
[r9468] updates and extends the functional test with SVG images. Now you can compare inclusion with `<object>` tags (by the "html4" writer) https://docutils.sourceforge.io/test/functional/expected/standalone_rst_html5.html#svg-images and with `<img>` tags (by the "html5" writer) https://docutils.sourceforge.io/test/functional/expected/standalone_rst_html4css1.html#svg-images. The source is https://docutils.sourceforge.io/test/functional/input/data/svg_images.txt It turns out that `<img>` is the most failprove, privacy-friendly and safe method to include SVGs, while `<object>` provides interactivity for included images but may fail under some circumstances. Fortunately, the ratio of SVGs "in the wild" without a `viewBox` seems to be decreasing over the last years. You may experiment with the `<object>` method using `rst2html4` or selecting the "html4" writer in Sphinx, to see whether it may work four your use cases. (The method was initially devised as a workaround for older browsers requiring a plug-in to display SVG images.) If it works satisfactory, we may consider using it in the "html5" writer as an alternative. Direct embedding is currently only available via "raw" (see the examples in `svg_images.txt`). As SVG images only work with HTML, this is no major limitation. For native support of embedding SVG, we still have to solve the issue on how to handle size and scaling options, (wrap in `<div>`, wrap in ´<svg>` with ViewPort, ...). I don't think the "rewriting method" will be implemented in Docutils: it is too complicated and error-prone. However, if we get direct embedding of SVG, users may create re-usable images if they want to go this way. You may try with "raw" to embedding two SVG files with one defining something to use and the second using it. --- **[feature-requests:#100] Support SVG hyperlinks and event handling** **Status:** open **Group:** Default **Created:** Wed Nov 01, 2023 09:15 PM UTC by Karl O. Pinc **Last Updated:** Wed Nov 01, 2023 09:19 PM UTC **Owner:** nobody SVG supports embedded hyperlinks, and the ability to trigger scripts on keyboard, mouse, and document events. But docutils does not, because SVG files are referenced by HTML "img" elements instead of "svg" elements. Might be best to use the SVG "image" element, nested in a HTML "svg" element, to reference the underlying SVG file. --- Sent from sourceforge.net because doc...@li... is subscribed to https://sourceforge.net/p/docutils/feature-requests/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/feature-requests/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |