Search code examples
htmlorg-mode

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.


Solution

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