Jan Joswig
Jan Joswig

Reputation: 733

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.

Upvotes: 5

Views: 1390

Answers (2)

Christian Lescuyer
Christian Lescuyer

Reputation: 19263

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

Upvotes: 1

Chris
Chris

Reputation: 137075

Use %20 for spaces, e.g.:

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

Upvotes: 6

Related Questions