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
{{ message }}
Repository navigation
Images in subpages named index.md have the incorrect path on Windows/cygwin #842
Interesting, I tried with a random SVG I found online and the response headers stated Content-Type:image/svg+xml but the image was still broken. This happened with and without livereload enabled.
As livereload is a simple wrapper around tordano's static file server, I checked and tordano seems to only ever have had one relevant issue filed regarding SVG (tornadoweb/tornado#1637). And according to that issue, SVG files have always been served as image/svg+xml. Not sure why any would be served as application/octet-stream. All that PR did was add SVG to the list of types that get GZip compression and it appears to have not made it into a release yet. And livereload has never had any SVG related issues filed.
@styfle all I can suggest is to make sure you are using the latest release of livereload, tornado, and MkDocs.
@d0ugal@waylan
You know, my initial post was incorrect. I said that <img alt="svg" src="./diagram.svg" /></p> is the correct output when in fact the output should be the relative path <img alt="svg" src="diagram.svg" /></p>
Is my markdown wrong? What's the proper way to include an image relative to the current md file?
What happens when you try to load the URL for the SVG file directly? Try going directly to http://127.0.0.1:8000/diagram.svg. Does that work properly?
It should simply display your SVG file in the browser. If it does anything else, then the problem is with the SVG file. If it works fine, then the problem is something else.
changed the title [-]Images in subpages names index.md have the incorrect path on Windows[/-][+]Images in subpages named index.md have the incorrect path on Windows/cygwin[/+]on Aug 17, 2016
@waylan I was using cygwin python package on my local machine and Windows Python on the server which explains why I was getting different results in each environment.
Unfortunately, none of the maintainers have access to a Windows machine with a cygwin environment. Therefore, it is difficult for us to debug this. My guess is that some code is checking which system MkDocs is running on and then doing something different with the paths. I assume that the problem is that in cygwin, it is (incorrectly) seeing Windows as a *nix system (Mac, Linux, Unix, etc). But without the ability to confirm the problem, we are unsure of how to fix it.
Any debugging help, patches, and/or pull requests are welcome and would move this along.
As @styfle noted above, as a workaround, you can use Windows Python rather than cygwin Python to avoid the problem.
If you don't know what cygwin is, then you almost certainly do not have is installed (its a Linux environment that runs inside Windows). That being the case, you have a different problem than what is being reported/discussed here. Please open a new issue with enough info to replicate your problem.
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
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.
Activity
d0ugal commentedon Feb 25, 2016
Interesting. Can you try with this option and let me know if that solves the svg issue?
styfle commentedon Feb 25, 2016
@d0ugal I tried and it does not solve the issue.
d0ugal commentedon Feb 26, 2016
Interesting, I tried with a random SVG I found online and the response headers stated
Content-Type:image/svg+xmlbut the image was still broken. This happened with and without livereload enabled.d0ugal commentedon Feb 26, 2016
Ah, I tried again with another SVG file and it worked fine with and without livereload. The content type was correct and the image rendered.
Can you let me know your mkdocs version? Either with
mkdocs --versionorpip freeze | grep mkdocsPartial fix for header links showing when the mouse is above the header
waylan commentedon Feb 26, 2016
As livereload is a simple wrapper around tordano's static file server, I checked and tordano seems to only ever have had one relevant issue filed regarding SVG (tornadoweb/tornado#1637). And according to that issue, SVG files have always been served as
image/svg+xml. Not sure why any would be served asapplication/octet-stream. All that PR did was add SVG to the list of types that get GZip compression and it appears to have not made it into a release yet. And livereload has never had any SVG related issues filed.@styfle all I can suggest is to make sure you are using the latest release of livereload, tornado, and MkDocs.
d0ugal commentedon Feb 26, 2016
Yeah, my best guess is that it is a really old MkDocs from when we hacked together out own server.
styfle commentedon Feb 26, 2016
@d0ugal @waylan I'm using the latest as far as I can tell.
styfle commentedon Feb 26, 2016
I'm running on Windows 10 with Cygwin.
Here is the pip packages which might be useful.
It looks like the latest version of tornadoweb.
d0ugal commentedon Feb 26, 2016
Interesting. Then my new best guess is that this is Windows related. All the versions you are using otherwise are known to be good o think.
waylan commentedon Feb 26, 2016
I just tried this on Windows 7 and was not able to reproduce the problem.
I got the following response (which works fine):
And I have the following installed:
d0ugal commentedon Feb 29, 2016
Hmm, odd. @styfle Have you tried this with a different SVG file just to ceck it isn't broken?
styfle commentedon Feb 29, 2016
@d0ugal @waylan
You know, my initial post was incorrect. I said that
<img alt="svg" src="./diagram.svg" /></p>is the correct output when in fact the output should be the relative path<img alt="svg" src="diagram.svg" /></p>Is my markdown wrong? What's the proper way to include an image relative to the current md file?
waylan commentedon Feb 29, 2016
What happens when you try to load the URL for the SVG file directly? Try going directly to
http://127.0.0.1:8000/diagram.svg. Does that work properly?It should simply display your SVG file in the browser. If it does anything else, then the problem is with the SVG file. If it works fine, then the problem is something else.
18 remaining items
[-]Images in subpages names index.md have the incorrect path on Windows[/-][+]Images in subpages named index.md have the incorrect path on Windows/cygwin[/+]waylan commentedon Aug 17, 2016
@styfle its not clear to me, but are you using Windows Python from cygwin or cygwin Python?
styfle commentedon Aug 17, 2016
@waylan I was using cygwin python package on my local machine and Windows Python on the server which explains why I was getting different results in each environment.
sergiomcalzada commentedon May 22, 2017
Any news on that bug? In windows 10 the paths are wron in mac the paths are correct :(
waylan commentedon May 22, 2017
Unfortunately, none of the maintainers have access to a Windows machine with a cygwin environment. Therefore, it is difficult for us to debug this. My guess is that some code is checking which system MkDocs is running on and then doing something different with the paths. I assume that the problem is that in cygwin, it is (incorrectly) seeing Windows as a *nix system (Mac, Linux, Unix, etc). But without the ability to confirm the problem, we are unsure of how to fix it.
Any debugging help, patches, and/or pull requests are welcome and would move this along.
As @styfle noted above, as a workaround, you can use Windows Python rather than cygwin Python to avoid the problem.
sergiomcalzada commentedon May 22, 2017
I don't know the diference between versions. Just donwloaded v3.6/2.7 from python website. Could you tell me how to download "windows python" version?
Thanks.
waylan commentedon May 22, 2017
If you don't know what cygwin is, then you almost certainly do not have is installed (its a Linux environment that runs inside Windows). That being the case, you have a different problem than what is being reported/discussed here. Please open a new issue with enough info to replicate your problem.
sergiomcalzada commentedon May 23, 2017
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
d97ulf commentedon Sep 20, 2017
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.
Internal Refactor of Pages, Files, and Navigation (mkdocs#1504)