* Add support for flow typecast comments
* Allow whitespace between comment start and colon
Also rename flow-comments.js to utils.js
* fix bug where type annotations could be accidentally created
* use better regex in detecting flow comment whitespace
* fix comment in utils.js
* simplify conditionals and improve comments
* fix lint error
- whitespace-sensitive formatting
- respect css `display: block`/`white-space: pre` (data from [`html-styles`](https://github.com/marionebl/html-styles))
- support magic comment (`<!-- display: block -->`)
- add an option to specify whitespace sensitivity (`--html-whitespace-sensitivity <css|strict|ignore>`)
- magic comments take precedence
- (default) `css`: respect default css style (safe in the most cases)
- `strict`: every node is considered whitespace sensitive (the safest)
- `ignore`: every node is considered whitespace insensitive (dangerous, the original behavior)
- inline inline-tags
- support ie conditional comment (`<!--[if IE]><![endif]-->`)
- indent the script/style content
- no inconsistent output for 2+ attributes
- force break tag if there're multiline attributes
Fixes#5238.
cc @duailibe for the [original change](https://github.com/prettier/prettier/pull/4413). I basically undid that PR because it didn't look to me like `shouldFlatten` made sense as the place to introduce the behavior it was going for, but I might have misunderstood something.
* Fix spacing around badges
* Switch the npm downloads badge to weekly
I switched to a weekly statistic since it feels more immediate and “9M/m” is somewhat confusing.
Instead of showing 80 carets, point out just which line the error was
on, and rely on the original message to point out the "column".
I thought about matching the `----^` in the original message with a
regex and use the length of it as the column number, but unfortunately
the original message does not show the original code (in this example
some whitespace is missing), so it wouldn't work.
Before:
```
$ ./bin/prettier.js test.hbs --parser glimmer
[error] test.hbs: SyntaxError: Parse error on line 2:
[error] {{one}}{{
[error] ---------^
[error] Expecting 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'EOF' (2:0)
[error] 1 | {{one}}
[error] > 2 | {{
[error] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] 3 |
```
After:
```
$ ./bin/prettier.js test.hbs --parser glimmer
[error] test.hbs: SyntaxError: Parse error on line 2:
[error] {{one}}{{
[error] ---------^
[error] Expecting 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'EOF' (2:0)
[error] 1 | {{one}}
[error] > 2 | {{
[error] 3 |
```
* Clarify semicolon example
* Add rationale for print width
Fixes#5081.
* Link options and rationale
* Add rationale for comments
Refs. #5121.
* Mention that spaces can be used for alignment for --use-tabs
Refs. #4199.
* Add missing word
* Remove bad `istanbul ignore next` example
* Update "Running Prettier manually in Vim" docs
- Add `--stdin-filepath` for parser inference.
- Reword "if you need a little more control" since it can be argued that
this approach gives you _less_ control than the plugins.
- Add note about error messages.
- Add note about cursor position.
* Clean up vim.md
- Replace the out-of-date vim-prettier information with a link to its
readme. Move vim-prettier to the top as compensation for its reduced
part of the page.
- Remove out-of-date instructions.
- Try to provide roughly the same information about Neoformat and ALE.
- Simplify language and formatting.
- Warn about setting parser at the top level. Refs. #4638.
- Remove top level parser from examples. Instead show the most common
options (I also removed printWidth, since we don't recommend changing
it). Refs. #4638.
- Show how to configure the flow parser for .js files. Refs. #4638.
- Update valid options for the parser option, including links and "since
version".
- Clarify babylon vs flow.