Open
Description
The vispy library uses the sphinxcontrib.apidoc extension to automatically generate our API documents at build time. These generated files just use apidoc/autodoc tools to pull the information from the python package's source code. The issue with this is that the default "Edit this page" link in the pydata-sphinx-theme points to where the API doc file would be if it was committed to the repository. Since they aren't you get a 404.
I've hacked something together that seems to work, but wondering if anyone here had suggestions to make it better using either smarter jinja2 tips or features in the theme that I'm not aware of. You can find all the details here: vispy/vispy#2220
But the main context changes make it pretty obvious what I'm doing:
html_context = {
"github_user": "vispy",
"github_repo": "vispy",
"github_version": "main",
"doc_path": "doc",
"edit_page_url_template": "{{ vispy_custom_edit_url(github_user, github_repo, github_version, doc_path, file_name, default_edit_page_url_template) }}",
"default_edit_page_url_template": "https://github.com/{github_user}/{github_repo}/edit/{github_version}/{doc_path}{file_name}",
"vispy_custom_edit_url": _custom_edit_url,
}