#17238 closed New feature (fixed)
Link to source code in docs
Reported by: | Santiago Basulto | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I think it would be useful to have a link to the source code for each class in the documentation. For example if somebody is looking for the ObjectDoesNotExist exception (https://docs.djangoproject.com/en/1.3/ref/exceptions/#django.core.exceptions.ObjectDoesNotExist), it would be nice to browse the source code.
CakePHP documentation does something similar.
Of course it's possible to get the source code through the package definition, i've done this and found the exception code: https://github.com/django/django/blob/master/django/core/exceptions.py
But with a link would be easier.
Change History (7)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
Sphinx has an extension to support this: http://sphinx.pocoo.org/ext/viewcode.html
I don't know if the website would support it out of the box. If it does, we could enable this extension.
Marking as DDN because this needs some testing before we commit to implementing it.
comment:3 by , 13 years ago
Triage Stage: | Design decision needed → Accepted |
---|
In fact, this ticket should be "Accepted", because the idea is worth exploring.
comment:4 by , 12 years ago
When I did this for the refactored CBV docs in June of 2012, @jacobian said he didn't want this feature and had me take out the direct code references. He said it made the documentation much harder to maintain.
comment:5 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
While some references in the docs could be auto linked to the appropriate source code file - many would not. This represents two challenges:
I actually have more of an issue with the latter. The docs should not require the source to make sense. If something is not explained well enough to use it without the source, then that is a problem with the docs. Anyone who want to better understand the internals, should develop the skills to quickly find that location in the source.
Lastly, the source browser and docs may not always be available to each other. I build docs locally - and then may move them somewhere for viewing - making links explicit makes the two overly coupled IMO.
I'm leaving this as unreviewed, as I feel my solo opinion is not enough to warrant a close.