Skip to content
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

gh-110631: Set three-space indents for reST in EditorConfig #110635

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Oct 10, 2023

https://devguide.python.org/documentation/style-guide/#use-of-whitespace says:

All reST files use an indentation of 3 spaces

EditorConfig is read by many editors, and there are plugins for others, so helps avoid incorrect tabs in reST files.

https://editorconfig.org/

@hugovk hugovk added needs backport to 3.11 only security fixes needs backport to 3.12 bug and security fixes labels Oct 10, 2023
@hugovk hugovk changed the title Set three-space indents for reST in EditorConfig gh-110631: Set three-space indents for reST in EditorConfig Oct 10, 2023
@AlexWaygood AlexWaygood enabled auto-merge (squash) October 10, 2023 14:30
@AlexWaygood AlexWaygood merged commit 66a9b10 into python:main Oct 10, 2023
@miss-islington
Copy link
Contributor

Thanks @hugovk for the PR, and @AlexWaygood for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 10, 2023
…thonGH-110635)

Set three-space indents in EditorConfig
(cherry picked from commit 66a9b10)

Co-authored-by: Hugo van Kemenade <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Oct 10, 2023

GH-110637 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Oct 10, 2023
@bedevere-app
Copy link

bedevere-app bot commented Oct 10, 2023

GH-110638 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Oct 10, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 10, 2023
…thonGH-110635)

Set three-space indents in EditorConfig
(cherry picked from commit 66a9b10)

Co-authored-by: Hugo van Kemenade <[email protected]>
AlexWaygood pushed a commit that referenced this pull request Oct 10, 2023
…H-110635) (#110638)

gh-110631: Set three-space indents for reST in EditorConfig (GH-110635)

Set three-space indents in EditorConfig
(cherry picked from commit 66a9b10)

Co-authored-by: Hugo van Kemenade <[email protected]>
AlexWaygood pushed a commit that referenced this pull request Oct 10, 2023
…H-110635) (#110637)

gh-110631: Set three-space indents for reST in EditorConfig (GH-110635)

Set three-space indents in EditorConfig
(cherry picked from commit 66a9b10)

Co-authored-by: Hugo van Kemenade <[email protected]>
@ezio-melotti
Copy link
Member

ezio-melotti commented Oct 11, 2023

FWIW, 3 doesn't seem to be the actual indentation level used by rst; it just happens to be one of the most commonly used -- because of directives.

.. directive:
   This text should be indented under the 'd' of directive, so 3 spaces

* This is a list

  * nested lists must be indented under the 'T' above, so 2 spaces

Some other things can be indented with any number of spaces >= 1. Setting 3 as a default is still a good idea.

Note: it's actually a bit more complicated than that. For directives you can also use a different number of spaces as long as you are consistent within the block, whereas lists seems to break more easily. Depending on the combination of what you are using, how you are indenting, and the presence of empty lines between different sections, different things might happen, some of which are not reported as error and, depending on the theme used, might look ok in the final render.

@hugovk hugovk deleted the editorconfig-rst branch October 11, 2023 10:01
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants