sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.43k stars 2.1k forks source link

ENH: link to gh source w/ ext.viewcode and/or ext.linkcode #11154

Open westurner opened 1 year ago

westurner commented 1 year ago

Is your feature request related to a problem? Please describe. As a docs reader, I want to read the source in the viewcode interface and then open it in {Github, Gitlab,}.

Describe the solution you'd like

Describe alternatives you've considered

Additional context :space_invader:

elliottower commented 1 year ago

this would be a really awesome feature, as you mention it seems like it should be possible using linkcode and viewcode it's possible to do edit buttons on documentation pages that bring you to the github markdown file, would be great to have links to full source files as well

rainbowphysics commented 4 months ago

Hey all, I wrote a gist today that could be adapted as a solution to this issue: https://gist.github.com/rainbowphysics/505e35a7a1e9545d5a6cde22f6ca9558

rainbowphysics commented 4 months ago

@pv If we went ahead with implementing this functionality, would you prefer it: integrated into sphinx.ext.linkcode, or added as a new ext module?