Search code examples
imagejupyter-notebookescapingmarkdown

How to escape spaces in filename when including image in markdown?


Working in a Jupyter notebook, I can include images directly in markdown like this:

![description](filename.bmp)

This does not seem to work if the filename contains spaces:

![description](file name with spaces.bmp)

Is there a way to escape the spaces in the filename in direct markdown? The following variants do not work:

![description]('file name with spaces.bmp')
![description]("file name with spaces.bmp")
![description](file\ name\ with\ spaces.bmp)
![description]('file\ name\ with\ spaces.bmp')
![description]("file\ name\ with\ spaces.bmp")
![description](file_name_with_spaces.bmp)
![description]((file name with spaces.bmp))
![description]({file name with spaces.bmp})

I am on Debian 10, by the way, if that matters.


Solution

  • Use %20 for spaces, e.g.:

    ![description](file%20name%20with%20spaces.bmp)