-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help projects use sphinx.ext.linkcode
so that source code links to GitHub
#186
Comments
A couple of comments.
|
Thanks Steve this is useful context! We were going back and forth on some of these considerations already and we don't have a clear path forward right now. It would be good to see if there is a way to enhance what the viewcode extension does 🤔 And you're right one of the biggest challenges is the actual source code lives in different subdirectories that differ across different packages, so finding a github url format that would work for all users of the theme may be tricky... |
The right way to do this is using We should try to adapt that code to Qiskit projects. We should expose a function in |
sphinx.ext.linkcode
so that source code links to GitHub
There are no examples of this in the wild:
For most projects, I suspect it's better to use I don't think there's anything the qiskit-sphinx-theme should do to generalize this mechanism. |
Many Qiskit projects use the viewcode sphinx extension which adds a [SOURCE] button to function and class definitions. This extension essentially generates a
modules
subfolder in the_build
directory when a sphinx build is run, and creates new html files that pull in the source code. We have heard feedback from users that instead it would be preferable to redirect to the classes and functions in GitHub (this also has the benefits of helping out contributors find where a specific python class/function lives). It would be great if we could engineer our own solution in the sphinx theme that works similarly to the viewcode extension, but instead adds a "view on GitHub" button to each class and function.ReadTheDocs has existing guidance on how to add "Edit source" links to pages using sphinx, and we used to implement something similar in the old breadcrumbs component, although it was broken most of the time because of the specific way that the github urls need to be pieced together.
The text was updated successfully, but these errors were encountered: