File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,18 +8,9 @@ deliberately limited and rarely added. Previous formatting is taken into account
88little as possible, with rare exceptions like the magic trailing comma. The coding style
99used by _ Black_ can be viewed as a strict subset of PEP 8.
1010
11- _ Black_ reformats entire files in place. It doesn't reformat lines that contain
12- ` # fmt: skip ` or blocks that start with ` # fmt: off ` and end with ` # fmt: on ` .
13- ` # fmt: skip ` can be mixed with other pragmas/comments either with multiple comments
14- (e.g. ` # fmt: skip # pylint # noqa ` ) or as a semicolon separated list (e.g.
15- ` # fmt: skip; pylint; noqa ` ). ` # fmt: on/off ` must be on the same level of indentation
16- and in the same block, meaning no unindents beyond the initial indentation level between
17- them. It also recognizes [ YAPF] ( https://github.com/google/yapf ) 's block comments to the
18- same effect, as a courtesy for straddling code.
19-
20- The rest of this document describes the current formatting style. If you're interested
21- in trying out where the style is heading, see [ future style] ( ./future_style.md ) and try
22- running ` black --preview ` .
11+ This document describes the current formatting style. If you're interested in trying out
12+ where the style is heading, see [ future style] ( ./future_style.md ) and try running
13+ ` black --preview ` .
2314
2415### How _ Black_ wraps lines
2516
Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ _Black_ is a well-behaved Unix-style command-line tool:
1212
1313## Usage
1414
15- To get started right away with sensible defaults:
15+ _ Black_ will reformat entire files in place. To get started right away with sensible
16+ defaults:
1617
1718``` sh
1819black {source_file_or_directory}
@@ -24,6 +25,17 @@ You can run _Black_ as a package if running it as a script doesn't work:
2425python -m black {source_file_or_directory}
2526```
2627
28+ ### Ignoring sections
29+
30+ Black will not reformat lines that contain ` # fmt: skip ` or blocks that start with
31+ ` # fmt: off ` and end with ` # fmt: on ` . ` # fmt: skip ` can be mixed with other
32+ pragmas/comments either with multiple comments (e.g. ` # fmt: skip # pylint # noqa ` ) or
33+ as a semicolon separated list (e.g. ` # fmt: skip; pylint; noqa ` ). ` # fmt: on/off ` must
34+ be on the same level of indentation and in the same block, meaning no unindents beyond
35+ the initial indentation level between them. Black also recognizes
36+ [ YAPF] ( https://github.com/google/yapf ) 's block comments to the same effect, as a
37+ courtesy for straddling code.
38+
2739### Command line options
2840
2941The CLI options of _ Black_ can be displayed by running ` black --help ` . All options are
@@ -191,7 +203,7 @@ All done! ✨ 🍰 ✨
191203
192204Show (or do not show) colored diff. Only applies when ` --diff ` is given.
193205
194- ### ` --line-ranges `
206+ #### ` --line-ranges `
195207
196208When specified, _ Black_ will try its best to only format these lines.
197209
You can’t perform that action at this time.
0 commit comments