When only one of the two passed paths starts with a slash, this function would produce results that depend on (and expose parts of) the actual current working directory.
In a similar manner, it was also possible to "break out" of the "current directory" by starting one of the paths with `../../..` etc.
Additionally, the fact that paths always end up being resolved relative to the current working directory made this function less efficient than it needs to be.
Fun fact: `get_relative_url('path_a', 'path_b')` actually ended up looking up how to get to `/current/working/directory/path_a` from `/current/working/directory/path_b`.
Luckily, none of these behaviors can ever actually come into effect (the function is always called without a leading slash and without paths deliberately trying to escape), but the fix is still good to reduce surprise.
*The actual fix* is that we make the leading slash ignored (or quite the opposite - we always add it).
Now when either of the two arguments try to go up higher than the top level, they just end up at the top level (e.g. `foo/../..` is effectively `.`), only then the "relative" calculation happens.
MkDocs
Project documentation with Markdown
MkDocs is a fast, simple and downright gorgeous static site generator that's geared towards building project documentation. Documentation source files are written in Markdown, and configured with a single YAML configuration file. It is designed to be easy to use and can be extended with third-party themes, plugins, and Markdown extensions.
Please see the Documentation for an introductory tutorial and a full user guide.
Features
- Build static HTML files from Markdown files.
- Use Plugins and Markdown Extensions to enhance MkDocs.
- Use the build-in themes, third party themes or create your own.
- Publish your documentation anywhere that static files can be served.
- Much more!
Support
If you need help with MkDocs, do not hesitate to get in contact with us!
You can either open a Discussion to ask questions or create an Issue to report a bug or make a feature request. Please note that we may only provide support for problems/questions regarding core features of MkDocs. Any questions or bug reports about features of third-party themes, plugins, extensions or similar should be made to their respective projects.
Links
- Official Documentation
- Latest Release Notes
- MkDocs Wiki (Third-party themes, recipes, plugins and more)
Contributing to MkDocs
The MkDocs project welcomes, and depends on, contributions from developers and users in the open source community. Please see the Contributing Guide for information on how you can help.
Code of Conduct
Everyone interacting in the MkDocs project's codebases, issue trackers, and discussion forums is expected to follow the PyPA Code of Conduct.