How to clean up the source code path when using gen_ref_pages.py
?
#622
-
I am using the sample Here is my specific Do you have any recommendations about how to get the source code path to be only the path starting at my package name? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You could try overriding templates to use For example in {% 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. |
Beta Was this translation helpful? Give feedback.
You could try overriding templates to use
relative_package_filepath
instead ofrelative_filepath
which depends on the current working directory.For example in
templates/python/material/function.html
:I'm considering adding some logic to the templates to use the relative filepath if its not absol…