-
Hi, Thank you for this project! I have an issue with the When I turn the option on and build my documentation locally with
However, when I try to publish my documentation, using
Is this a bug or am I missing something? Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi! When showing the source, we compute the path to the file relatively to the current working directory. So when you serve from within your project, it works fine, but when you deploy from another project, the relative path cannot be computed anymore, and the absolute path is used instead. The next version of MkDocs comes with the ability to specify a path as relative to the config file (or docs dir, or current page), so we should then be able to add an option to Griffe to specify the base path using this. Relative paths will then always be computed relatively to this base path. In the meantime, if you're willing to override templates (which I don't really recommend doing until we have proper Jinja blocks), you can change % git grep relative_filepath
src/mkdocstrings_handlers/python/templates/material/_base/class.html: <summary>Source code in <code>{{ class.relative_filepath }}</code></summary>
src/mkdocstrings_handlers/python/templates/material/_base/class.html: <summary>Source code in <code>{{ class.relative_filepath }}</code></summary>
src/mkdocstrings_handlers/python/templates/material/_base/function.html: <summary>Source code in <code>{{ function.relative_filepath }}</code></summary> This will give more consistent results, but will drop any folder above the Python package (like |
Beta Was this translation helpful? Give feedback.
-
We now automatically switch to the relative package path if the relative path itself is absolute, see #622. |
Beta Was this translation helpful? Give feedback.
Hi!
When showing the source, we compute the path to the file relatively to the current working directory. So when you serve from within your project, it works fine, but when you deploy from another project, the relative path cannot be computed anymore, and the absolute path is used instead.
The next version of MkDocs comes with the ability to specify a path as relative to the config file (or docs dir, or current page), so we should then be able to add an option to Griffe to specify the base path using this. Relative paths will then always be computed relatively to this base path.
In the meantime, if you're willing to override templates (which I don't really recommend doing until we have p…