You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This image isn't found as server wants it to be in subpage/img/screenshot.png ??
So this forces invalid markup which doesn't work with other MD engines!
The problem, is that subpage.md moves to subpage/index.html and thus the relative location of the img is incorrect. To fix this I think we need to infer an abolute location (by resolving the relative one to the .md file) and then use for image links.
However, AFAICT, this will involve processing and re-writing the HTML which would get messy.
I'm confused. As far as I'm aware we do infer the correct relative location, which when translated into a URL will differ depending on if it was a link from subpage.md or index.md.
To fix this I think we need to infer an abolute location
I can't see why we'd need to be moving away from the current relative URLs, although if they're currently incorrectly generated for non-index pages then that needs fixing of course.
How should an image be added on subpage.md? Given the structure above? Maybe we just need to document this better, I don't fully understand but requiring people to put "../" seems wrong when that extra level isn't there in the source files.
Yup indeed - the source should be marked up as  in both cases, but the translation to HTML should render different links in each case, including the required .. in one case but not in the other. As far as I was concerned we're handling both cases correctly when we translate them into relative URLs, but haven't checked lately.
Sorry if I comment on this closed issue, but this situation with nested pages and images is not working with mkdocs 1.1.2 and I cannot find useful info in the documentation; in my case I have
where inside embedded/micro.md there is an image with path images/STM32-pinout.png but it's not rendered since the final path is not adapted to match the layout of the repo, indeed the mkdocs serve complains with
WARNING - Documentation file 'embedded/micro.md' contains a link to 'embedded/images/STM32-pinout.png' which is not found in the documentation files..
@gipi Paths are not absolute. If your images folder is placed in your docs folder where the folder embedded is at the same level (docs, docs/images, and docs/embedded), the link should go to ../images/STM32-pinout.png.
I had the same problem where mkdocs just would not find the images in my media folder. The problem was my file endings. While I was linking to ./media/image.png in the markdown file the actual image had the file ending .PNG.
This issue was closed 6.5 years ago. The code which controls this has been rewritten multiple times since this issue was opened. Do not rely on the comments in this issue for current behavior. The current behavior is documented here. If you have any issues with the current documentation, then please open a new issue.
Activity
dnrce commentedon Sep 14, 2014
👍
d0ugal commentedon Oct 7, 2014
The problem, is that subpage.md moves to subpage/index.html and thus the relative location of the img is incorrect. To fix this I think we need to infer an abolute location (by resolving the relative one to the .md file) and then use for image links.
However, AFAICT, this will involve processing and re-writing the HTML which would get messy.
Any better ideas?
lovelydinosaur commentedon Oct 7, 2014
I'm confused. As far as I'm aware we do infer the correct relative location, which when translated into a URL will differ depending on if it was a link from
subpage.mdorindex.md.I can't see why we'd need to be moving away from the current relative URLs, although if they're currently incorrectly generated for non-index pages then that needs fixing of course.
d0ugal commentedon Oct 7, 2014
How should an image be added on subpage.md? Given the structure above? Maybe we just need to document this better, I don't fully understand but requiring people to put "../" seems wrong when that extra level isn't there in the source files.
lovelydinosaur commentedon Oct 7, 2014
Yup indeed - the source should be marked up as
in both cases, but the translation to HTML should render different links in each case, including the required..in one case but not in the other. As far as I was concerned we're handling both cases correctly when we translate them into relative URLs, but haven't checked lately.d0ugal commentedon Oct 7, 2014
Right, so I tested this and confirmed the issue. I'll investigate the fix. I'm not sure which bit of the code is responsible for this yet.
Fix image paths in non-index markdown files
gipi commentedon Apr 27, 2021
Sorry if I comment on this closed issue, but this situation with nested pages and images is not working with mkdocs 1.1.2 and I cannot find useful info in the documentation; in my case I have
where inside
embedded/micro.mdthere is an image with pathimages/STM32-pinout.pngbut it's not rendered since the final path is not adapted to match the layout of the repo, indeed themkdocs servecomplains withWARNING - Documentation file 'embedded/micro.md' contains a link to 'embedded/images/STM32-pinout.png' which is not found in the documentation files..martinbira commentedon Apr 27, 2021
@gipi Paths are not absolute. If your
imagesfolder is placed in yourdocsfolder where the folderembeddedis at the same level (docs,docs/images, anddocs/embedded), the link should go to../images/STM32-pinout.png.benutz commentedon May 10, 2021
I had the same problem where mkdocs just would not find the images in my media folder. The problem was my file endings. While I was linking to ./media/image.png in the markdown file the actual image had the file ending .PNG.
waylan commentedon May 10, 2021
This issue was closed 6.5 years ago. The code which controls this has been rewritten multiple times since this issue was opened. Do not rely on the comments in this issue for current behavior. The current behavior is documented here. If you have any issues with the current documentation, then please open a new issue.