You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
some themes like sphinx_rtd_theme emit "Edit on GitHub" links to the page source in the git repository. For autogenerated pages this link points to something that doesn't exist, i.e. using such a theme with autogenerated modules often results in invalid links in the documentation.
I've seen this issue several times in the wild now, so I believe many would profit from a better default handling of this situation, or at least some prominent documentation. It's of course arguable whether the fix should go here or into the theme code. This issue was also raised in readthedocs/sphinx_rtd_theme#324 and their resolution (see readthedocs/sphinx_rtd_theme#393) was to simply use sphinx's hasdoc() function to check whether the current page refers to a physical (vs autogenerated) document. A can't comment on whether their interpretation of the purpose of hasdoc is correct since there is very little documentation on it, but that's the status quo.
The relevant section in sphinx_rtd_theme's page generation template checks for hasdoc(page) and display_github.
A user can therefore fix this problem in their conf.py by setting display_github = False for automod generated pages like this:
Hey,
some themes like sphinx_rtd_theme emit "Edit on GitHub" links to the page source in the git repository. For autogenerated pages this link points to something that doesn't exist, i.e. using such a theme with autogenerated modules often results in invalid links in the documentation.
I've seen this issue several times in the wild now, so I believe many would profit from a better default handling of this situation, or at least some prominent documentation. It's of course arguable whether the fix should go here or into the theme code. This issue was also raised in readthedocs/sphinx_rtd_theme#324 and their resolution (see readthedocs/sphinx_rtd_theme#393) was to simply use sphinx's
hasdoc()
function to check whether the current page refers to a physical (vs autogenerated) document. A can't comment on whether their interpretation of the purpose ofhasdoc
is correct since there is very little documentation on it, but that's the status quo.The relevant section in sphinx_rtd_theme's page generation template checks for
hasdoc(page) and display_github
.A user can therefore fix this problem in their
conf.py
by settingdisplay_github = False
for automod generated pages like this:The
context['meta'] = None
assignment is needed to prevent an automatic setting ofdisplay_github = True
.Alternatively, one could override
hasdoc
similar to this (untested):So possible fixes in sphinx-automodapi could amount to one of:
hasdoc()
return False by preventing autogenerated pages from being included inBuilder.env.all_docs
(see first line of hasdoc)The text was updated successfully, but these errors were encountered: