Document shebang comment behaviour (#3787)

This commit is contained in:
rax 2023-07-11 14:16:43 -05:00 committed by GitHub
parent 37895f8e50
commit 6123b4ac26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -254,11 +254,12 @@ required due to an inner function starting immediately after.
_Black_ does not format comment contents, but it enforces two spaces between code and a _Black_ does not format comment contents, but it enforces two spaces between code and a
comment on the same line, and a space before the comment text begins. Some types of comment on the same line, and a space before the comment text begins. Some types of
comments that require specific spacing rules are respected: doc comments (`#: comment`), comments that require specific spacing rules are respected: shebangs (`#! comment`), doc
section comments with long runs of hashes, and Spyder cells. Non-breaking spaces after comments (`#: comment`), section comments with long runs of hashes, and Spyder cells.
hashes are also preserved. Comments may sometimes be moved because of formatting Non-breaking spaces after hashes are also preserved. Comments may sometimes be moved
changes, which can break tools that assign special meaning to them. See because of formatting changes, which can break tools that assign special meaning to
[AST before and after formatting](#ast-before-and-after-formatting) for more discussion. them. See [AST before and after formatting](#ast-before-and-after-formatting) for more
discussion.
### Trailing commas ### Trailing commas