Opened 3 weeks ago

Last modified 4 days ago

#36305 assigned Cleanup/optimization

Documentation guidelines around indenting reference docs

Reported by: Sarah Boyce Owned by: Ahmed Nassar
Component: Documentation Version: 5.2
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

We have some inconsistency around indenting within the documentation.
For example:

Based off the Sphinx documentation, we should indent the content: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#:~:text=Options%20must%20be%20indented%20to%20the%20same%20level%20as%20the%20directive%20content.

Basically, a directive consists of a name, arguments, options and content. (Keep this terminology in mind, it is used in the next chapter describing custom directives.) Looking at this example,

.. function:: foo(x)
              foo(y, z)
   :module: some.module.name

   Return a line of text input from the user.

function is the directive name. It is given two arguments here, the remainder of the first line and the second line, as well as one option module (as you can > see, options are given in the lines immediately following the arguments and indicated by the colons). Options must be indented to the same level as the directive content.

Note that if we were to use the toc_object_entries Sphinx setting to auto generate the table of contents, this would not generate correctly for pages with the wrong indents.

I believe some guidelines around indenting should be documented within https://docs.djangoproject.com/en/5.2/internals/contributing/writing-documentation/#guidelines-for-restructuredtext-files would be useful.

According to the ticket's flags, the next step(s) to move this issue forward are:

  • To improve the patch as described in the pull request review comments or on this ticket, then uncheck "Patch needs improvement".
  • If creating a new pull request, include a link to the pull request in the ticket comment when making that update. The usual format is: [https://github.com/django/django/pull/#### PR].

Change History (6)

comment:1 by Natalia Bidart, 3 weeks ago

Triage Stage: UnreviewedAccepted

Thank you Sarah, I agree this is an issue that is worth fixing. Another example of mixed indentations is, for example, https://docs.djangoproject.com/en/5.2/ref/middleware/

comment:2 by Ahmed Nassar, 3 weeks ago

Owner: set to Ahmed Nassar
Status: newassigned

comment:3 by Ahmed Nassar, 3 weeks ago

Has patch: set

comment:4 by Sarah Boyce, 3 weeks ago

Patch needs improvement: set

comment:5 by Ahmed Nassar, 11 days ago

Patch needs improvement: unset

comment:6 by Bruno Alla, 4 days ago

Patch needs improvement: set
Note: See TracTickets for help on using tickets.
Back to Top