How to escape spaces in filename when including image in markdown?
Asked Answered
P

2

5

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.

Predecessor answered 10/7, 2020 at 7:5 Comment(0)
A
5

Use %20 for spaces, e.g.:

![description](file%20name%20with%20spaces.bmp)
Adjective answered 10/7, 2020 at 11:54 Comment(0)
E
1

The %20 encoding did not work in my GitHub flavored markdown.

Surrounding the file name with angle brackets did.

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

Github Example 498

Empennage answered 24/4, 2024 at 17:19 Comment(1)
That works for me an it's much easier than replacing all spaces. Thanks!Oxytocin

© 2022 - 2025 — McMap. All rights reserved.