Skip to content Skip to sidebar Skip to footer

Is 3-space Indentation Required In Rest?

I'm documenting my Python code using Sphinx, and read in the Python developer's guide (and I think elsewhere as well) that reST files use an indentation of 3 spaces: All reST file

Solution 1:

As you have found through your research of the authoritative source and elsewhere, there is no definitive indentation specification, except a minimum of 2 spaces for option lists, and a minimum of 3 spaces for footnotes. See the specification on indentation for reStructuredText.

That said, there are some recommendations.

  1. Choose a style and keep it consistent for your documentation.
  2. IDEs often complain about incorrect indentation, like for docstrings in Python, so using 4 spaces can avoid those warnings.
  3. IDEs can be set to indent to 4 spaces for code, so why not keep it the same for documentation?
  4. See my bonus tip about indenting for numbered lists.

Post a Comment for "Is 3-space Indentation Required In Rest?"