mkdocs: Images in subpages named index.md have the incorrect path on Windows/cygwin

I am using the following markdown in index.md and running mkdocs serve

## Diagram
This is the svg
![svg](diagram.svg)

The output is correct

<img alt="svg" src="./diagram.svg" /></p>

However I get a broken image as seen below

image

It appears that the svg file is served as application/octet-stream instead of the expected image/svg+xml

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 34 (30 by maintainers)

Commits related to this issue

Most upvoted comments

I stumbled upon this ticket while trying to get MkDocs to serve SVG files in a Docker container. I just wanted to add to the record that it seems like the Python mimetypes module is looking in certain predefined places for a “mime.types” file - e.g. /etc/mime.types or /etc/httpd/mime.types. It is strange that it does not supply its own file, but obviously that’s how it is implemented…

Since my Docker image is a minimalistic image based on Alpine Linux, there were no mime.types files. After installing the “mailcap” package containing the /etc/mime.types file, the SVG files are now served by MkDocs in the correct way.

I guess this could be the case when running in cygwin on Windows as well. If /etc/mime.types is missing, you will end up with octet-streams for SVGs.

I know that cygwin is a compiler… so when you said Windows Python/cygwin Python I thought that should be different “python compiled versions” (I dont know how python is generated/compiled/executed).

At the end, cygwind Phyton is to run “mkdocs” in “ubuntu in windows” (or something similar). I will try it and see if it works