New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mkdocs_page_input_path uses backslashes on Windows #850
Comments
Windows uses backslashes for file paths. The value of the input path is the string returned by Windows itself. MkDocs converts it to a properly formed URL when creating the page URL, but not before. After all, when MkDocs reads the contents of the file, it uses the value of the input path which needs to be formatted for the local file system. Note that here, the Therefore, this is not a bug, but intended behavior. If you want to work with that value, then you will need to convert it to something that you can use first. |
I think the code you linked to is fine. I believe the problem is in readthedocs/base.html. The backslashes should be escaped before it is injected into the string. I would expect the output to have two backslashes. var mkdocs_page_input_path = "client-support\\City.md"; |
Ah, I see what you are getting at. Another one of those annoying Windows edge cases that those of us who don't work on the platform easily miss. I suppose a template filter could address this. Or perhaps the value could be modified when building the template context. Patches are of course welcome. Its always best when a person who actually uses the platform provides a solution. |
I would definitely do that if I understood a little more about python. The JSON Serialization fix that @d0ugal just made should solve this problem (among others). Thanks for the quick response and fix! 💯 |
When building on Windows, it looks like the
mkdocs_page_input_path
uses backslashes instead of forward slashes. I'm writing a script to get the original source file and I can't because it gets malformed since '\c` is a non-printable character.HTML emitted on page
My extra.js script
The text was updated successfully, but these errors were encountered: