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

1 Answer 1

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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