Provide "View on Github" link for source files.
Often when browsing the documentation I end up viewing the source code on djangoproject.com (like this page here). From here I often need to check the file on Github, of link to a certain line in the code (on GitHub), which I have to do manually.
It would be useful to provide a "view this file on github" link for source code pages that link to their corresponding file.
Yeah, not a bad idea. This sounds like a thing we'd need to do on Sphinx' side.
Linking to GitHub source files would be really helpful. I've found myself missing this feature.
We could change the "[source]" links and have them point directly to the GitHub source pages. The "View on GitHub" links should still be added for users that visit the source code pages on docs.djangoproject.com directly.
A simple solution to accomplish the above would be to create our own Sphinx documentation extension that is very much similar to the sphinx.ext.viewcode that is already enabled for Django documentation.
- Change "[source]" links by modifying def doctree_read.
- Add "View in Github" links by modifying def collect_pages.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Fixed by https://github.com/django/django/pull/15808 I think.
Not yet fixed. Couldn't find a "View on GitHub" link to view the corresponding source file on GitHub.
@zachborboa you're right. I reopened this issue. Would you try to propose a PR to fix this?
Would you try to propose a PR to fix this?
Thanks for reopening. Will work on one
Will enable the "sphinx.ext.linkcode" extension and implement linkcode_resolve().
https://www.sphinx-doc.org/en/master/usage/extensions/linkcode.html
created https://github.com/django/django/pull/16203