djangoproject.com icon indicating copy to clipboard operation
djangoproject.com copied to clipboard

Provide "View on Github" link for source files.

Open phalt opened this issue 11 years ago • 8 comments

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.

phalt avatar Feb 12 '15 10:02 phalt

Yeah, not a bad idea. This sounds like a thing we'd need to do on Sphinx' side.

jezdez avatar Apr 01 '15 17:04 jezdez

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.

zachborboa avatar Jan 19 '19 10:01 zachborboa

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.

stale[bot] avatar Oct 06 '22 10:10 stale[bot]

Fixed by https://github.com/django/django/pull/15808 I think.

carltongibson avatar Oct 06 '22 10:10 carltongibson

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?

zachborboa avatar Oct 19 '22 02:10 zachborboa

Would you try to propose a PR to fix this?

Thanks for reopening. Will work on one

zachborboa avatar Oct 19 '22 21:10 zachborboa

Will enable the "sphinx.ext.linkcode" extension and implement linkcode_resolve(). https://www.sphinx-doc.org/en/master/usage/extensions/linkcode.html

zachborboa avatar Oct 20 '22 06:10 zachborboa

created https://github.com/django/django/pull/16203

zachborboa avatar Oct 20 '22 19:10 zachborboa