I am using the sample gen_ref_pages.py script in the documentation. Everything looks great locally, but when I deploy my documentation via GitHub, I get the following:
Here is my specific gen_ref_pages.py script, and here is a page highlighting the above image.
Do you have any recommendations about how to get the source code path to be only the path starting at my package name?
You could try overriding templates to use relative_package_filepath instead of relative_filepath which depends on the current working directory.
For example in templates/python/material/function.html:
{% extends "_base/function.html" %} {% block source scoped %} {% if config.show_source and function.source %} <details class="quote"> <summary>{{ lang.t("Source code in") }} <code>{{ function.relative_package_filepath }}</code></summary> {{ function.source|highlight(language="python", linestart=function.lineno, linenums=True) }} </details> {% endif %} {% endblock source %}
I'm considering adding some logic to the templates to use the relative filepath if its not absol…
You could try overriding templates to use relative_package_filepath instead of relative_filepath which depends on the current working directory.
For example in templates/python/material/function.html:
{% extends "_base/function.html" %} {% block source scoped %} {% if config.show_source and function.source %} <details class="quote"> <summary>{{ lang.t("Source code in") }} <code>{{ function.relative_package_filepath }}</code></summary> {{ function.source|highlight(language="python", linestart=function.lineno, linenums=True) }} </details> {% endif %} {% endblock source %}
I'm considering adding some logic to the templates to use the relative filepath if its not absolute, and fallback to the relative package filepath.
2 replies
