docs: Move fmt: off
docs (#4090)
This commit is contained in:
parent
432d9050c3
commit
e7e122e9ff
@ -8,18 +8,9 @@ deliberately limited and rarely added. Previous formatting is taken into account
|
||||
little as possible, with rare exceptions like the magic trailing comma. The coding style
|
||||
used by _Black_ can be viewed as a strict subset of PEP 8.
|
||||
|
||||
_Black_ reformats entire files in place. It doesn't reformat lines that contain
|
||||
`# fmt: skip` or blocks that start with `# fmt: off` and end with `# fmt: on`.
|
||||
`# fmt: skip` can be mixed with other pragmas/comments either with multiple comments
|
||||
(e.g. `# fmt: skip # pylint # noqa`) or as a semicolon separated list (e.g.
|
||||
`# fmt: skip; pylint; noqa`). `# fmt: on/off` must be on the same level of indentation
|
||||
and in the same block, meaning no unindents beyond the initial indentation level between
|
||||
them. It also recognizes [YAPF](https://github.com/google/yapf)'s block comments to the
|
||||
same effect, as a courtesy for straddling code.
|
||||
|
||||
The rest of this document describes the current formatting style. If you're interested
|
||||
in trying out where the style is heading, see [future style](./future_style.md) and try
|
||||
running `black --preview`.
|
||||
This document describes the current formatting style. If you're interested in trying out
|
||||
where the style is heading, see [future style](./future_style.md) and try running
|
||||
`black --preview`.
|
||||
|
||||
### How _Black_ wraps lines
|
||||
|
||||
|
@ -12,7 +12,8 @@ _Black_ is a well-behaved Unix-style command-line tool:
|
||||
|
||||
## Usage
|
||||
|
||||
To get started right away with sensible defaults:
|
||||
_Black_ will reformat entire files in place. To get started right away with sensible
|
||||
defaults:
|
||||
|
||||
```sh
|
||||
black {source_file_or_directory}
|
||||
@ -24,6 +25,17 @@ You can run _Black_ as a package if running it as a script doesn't work:
|
||||
python -m black {source_file_or_directory}
|
||||
```
|
||||
|
||||
### Ignoring sections
|
||||
|
||||
Black will not reformat lines that contain `# fmt: skip` or blocks that start with
|
||||
`# fmt: off` and end with `# fmt: on`. `# fmt: skip` can be mixed with other
|
||||
pragmas/comments either with multiple comments (e.g. `# fmt: skip # pylint # noqa`) or
|
||||
as a semicolon separated list (e.g. `# fmt: skip; pylint; noqa`). `# fmt: on/off` must
|
||||
be on the same level of indentation and in the same block, meaning no unindents beyond
|
||||
the initial indentation level between them. Black also recognizes
|
||||
[YAPF](https://github.com/google/yapf)'s block comments to the same effect, as a
|
||||
courtesy for straddling code.
|
||||
|
||||
### Command line options
|
||||
|
||||
The CLI options of _Black_ can be displayed by running `black --help`. All options are
|
||||
@ -191,7 +203,7 @@ All done! ✨ 🍰 ✨
|
||||
|
||||
Show (or do not show) colored diff. Only applies when `--diff` is given.
|
||||
|
||||
### `--line-ranges`
|
||||
#### `--line-ranges`
|
||||
|
||||
When specified, _Black_ will try its best to only format these lines.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user