hatmatrix
hatmatrix

Reputation: 44932

How do I include an svg image in exported html file using emacs org-mode?

I've tried the following syntax:

[[folder/figure.svg]]

along with org-export-as-html.

This apparently does not work - just adds a reference ... in the html file.

Upvotes: 3

Views: 4404

Answers (2)

Julian
Julian

Reputation: 1301

In Org mode, the org-export-html-inline-image-extensions variable determines which image files get inlined and not linked in the html output. You should also check the settings of the org-export-html-inline-images variable, in case also other types of images do not get inlined.

To customize these options, you can

M-x customize-option org-export-html-inline-image-extensions

or use the menu 'Options > Customize Emacs > Specific Option' in case you have a GUI available.

Upvotes: 1

Jonathan Leech-Pepin
Jonathan Leech-Pepin

Reputation: 7884

I had to test this a couple times to clarify exactly what the issue appeared to be. The image exports successfully when I use the following link:

Current folder is ~/test/
[[./img/Bitmap.svg]]
[[./Bitmap.svg]]
[[~/test/Bitmap.svg]]

However it fails with:

Current folder is ~/test/
[[img/Bitmap.svg]]
[[Bitmap.svg]]

I suspect it is that Org has to find where on the path the image is, the ./ tells it to look from current location, while ~/ can be properly expanded by the shell to give the current directory.

If you prefix ./ to your images they should export correctly.

Upvotes: 5

Related Questions