9

Normally, when I export to html an org-mode buffer that contains a link to an image, the link is coverted to a proper html <img...>. However, if that image has a .svg extension, it is exported as an <object...> instead.

How do I prevent this?

For instance, the following link:

[[file:https://clojars.org/malabarba/lazy-map/latest-version.svg]]

gets exported like this:

<object type="image/svg+xml" data="https://clojars.org/malabarba/lazy-map/latest-version.svg" >
Sorry, your browser does not support SVG.</object>

But I'd like it to be exported like this:

<img src="https://clojars.org/malabarba/lazy-map/latest-version.svg">
2

Using a :fallback attribute almost does it:

#+ATTR_HTML: :fallback /tmp/toto.svg
[[file:/tmp/toto.svg]]

is exported as:

<div class="figure">
<p><object type="image/svg+xml" data="file:///tmp/toto.svg" >
<img src="/tmp/toto.svg"  /></object>
</p>
</div>

Otherwise, it seems easy to redefine or advice org-html--format-image in ox-html.el (for some reason, it treats svg's specially).

| improve this answer | |
  • Thanks. If no-one knows a configuration option for this, I'll just have to advise that function. – Malabarba Nov 16 '15 at 7:39
  • @Malabarba can you show us how you advised it? – Linus Arver May 2 '18 at 6:28
  • It works great! How have you discovered that? – Felipe Sep 16 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.