Docusaurus: Trailing slash breaks images

Created on 15 Jul 2020  路  5Comments  路  Source: facebook/docusaurus

Hi. I am using docusaurus v2. While everything works great, trailing slash is breaking images.

I have a markdown syntax like this where I am storing myimage in the same folder as the markdown file

[![IMAGE ALT TEXT](./myimage.png)](https://www.example.com "My Image description")

It fails because of the trailing slash. If I fix in the website by maybe adding ../ it will not render in Github. Is there any way to make it work both in Github and the website as well?

Screenshot below:

Screenshot from 2020-07-15 09-34-55

Directory structure:

Screenshot from 2020-07-15 09-37-43

I guess the same path logic you guys are using for generating html out of .md and rewriting paths can be used for images as well.

Thanks in advance.

bug needs triage

All 5 comments

If I put it in static folder and try to access it that way, it will work in the website but will break when rendering in the Github repo. Was wondering what to do.

Hi,

Currently we don't support well using relative md images, so it's hard to support both github + website at the same time.

This is something I want to solve in https://github.com/facebook/docusaurus/issues/3057

@slorber Thanks for the clarification. Will use the absolute url till then. Feel free to close this issue if you want.

#3069 this solve relative images

Hey all, this is feature is now released!
If you like it, don't forget to retweet 馃槃
https://twitter.com/docusaurus/status/1286715187983048704

Was this page helpful?
0 / 5 - 0 ratings

Related issues

taylorreece picture taylorreece  路  28Comments

cameronelliott picture cameronelliott  路  28Comments

slorber picture slorber  路  24Comments

arifszn picture arifszn  路  24Comments

knowbody picture knowbody  路  23Comments