Briefly
If I org-latex-export-to-pdf
an org file with SVG diagrams, I get a single self-contained file that can be conveniently sent as draft.
If I instead org-html-export-to-html
(avoiding all the hassles of page breaks; making it easy to read the document on a non-exotic tablet; etc...), the SVG files remain outside the HTML file, making it necessary to tar-gzip a bundle of files. Yet SVG is eminently suitable for embedding in HTML.
Details
This is a sequel to a question asked earlier. In the present question we start directly from SVG files, not from Gnuplot.
If I start Emacs with a .emacs
consisting of just
this code,
and export the org-mode file
#+HTML_EMBED_SVG: t
Here is a square.
[[./square.svg]]
to HTML, I am expecting to see the SVG file embedded in the HTML file, but I am instead seeing
<img src="./square.svg" alt="square.svg" class="org-svg" />
in the HTML file.
How can I embed SVG images when exporting to HTML from Org?
Versions
- Org mode version 9.6.1
- GNU Emacs 30.0.50
This bleeding-edge pre-release of Emacs is compelling because it natively supports viewing SVG figures inline in the Emacs buffer.
MWE completeness
To make this a self-contained MWE, here is square.svg
.
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="100" height="100"
viewBox="0 0 100 100"
version="1.1">
<g>
<path d="M 10 10 L 90 10 L 90 90 L 10 90 z"
fill="grey" stroke="black" stroke-width="3" />
</g>
</svg>