docs on whitespace sensitivity: better wording (#6699)

master
Georgii Dolzhykov 2019-10-23 21:57:00 +03:00 committed by GitHub
parent 63b450b8e6
commit 2c14a7f13c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -37,7 +37,7 @@ As you may notice during daily HTML works, the following two cases won't produce
| with spaces | `1<b> 2 </b>3` | 1<b> 2 </b>3 |
| without spaces | `1<b>2</b>3` | 1<b>2</b>3 |
This is because whitespaces are sensitive in inline elements.
This happens because whitespace is significant in inline elements.
For this reason, we cannot safely format
@ -59,8 +59,8 @@ since it may modify the displayed output in the browser.
Instead of breaking your code or just doing nothing, we introduce _whitespace-sensitive formatting_, which:
- follows the default CSS `display` value for every element to identify if the whitespace is sensitive,
- and borrows the opening or closing tags (if necessary) to avoid adding or removing sensitive whitespaces.
- follows the default CSS `display` value for every element to identify if the whitespace inside it is significant,
- and wraps the tags in such a way as to avoid adding or removing significant whitespace.
For example:
@ -81,7 +81,7 @@ For example:
</div>
```
We also allow magic comments (e.g., `<!-- display: block -->`) to tell Prettier how to format this element
We also allow magic comments (e.g., `<!-- display: block -->`) to tell Prettier how to format elements
due to the fact that CSS display can be changed:
<!-- prettier-ignore -->
@ -98,13 +98,13 @@ due to the fact that CSS display can be changed:
```
There's also an option for the global whitespace sensitivity
in case you may want maximum safety or you just don't care about those whitespaces:
in case you may want maximum safety or you just don't care about that whitespace:
`--html-whitespace-sensitivity` (defaults to `css`)
- `css` - Respect the default value of CSS `display` property.
- `strict` - Whitespaces are considered sensitive.
- `ignore` - Whitespaces are considered insensitive.
- `strict` - All whitespace is considered significant.
- `ignore` - All whitespace is considered insignificant.
##### Automatic parser inference