Opened 2 years ago

Last modified 17 months ago

#17238 new New feature

Link to source code in docs

Reported by: santiagobasulto 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


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 (, 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:

But with a link would be easier.

Attachments (0)

Change History (4)

comment:1 Changed 2 years ago by ptone

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

While some references in the docs could be auto linked to the appropriate source code file - many would not. This represents two challenges:

  • going in and finding all the references and making them links/explicit to source location
  • setting the expectation that all future docs efforts follow this standard

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.

comment:2 Changed 2 years ago by aaugustin

  • Triage Stage changed from Unreviewed to Design decision needed

Sphinx has an extension to support this:

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 Changed 2 years ago by aaugustin

  • Triage Stage changed from Design decision needed to Accepted

In fact, this ticket should be "Accepted", because the idea is worth exploring.

comment:4 Changed 17 months ago by pydanny

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
as new
The owner will be changed from nobody to anonymous. Next status will be 'assigned'
as The resolution will be set. Next status will be 'closed'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.