docs(blog): 1.15 release (#5296)

master
Ika 2018-11-07 09:09:04 +08:00 committed by GitHub
parent 4559a774bb
commit fa40f2ddd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1949 additions and 32 deletions

View File

@ -5,6 +5,7 @@
files: "\\.(\
css|less|scss\
|graphql|gql\
|html\
|js|jsx\
|json\
|md|markdown|mdown|mkdn\

View File

@ -4,19 +4,33 @@
<p align="center">
<em>
JavaScript
· Flow
· TypeScript
· CSS
· SCSS
· Less
· JSX
· Vue
· GraphQL
· JSON
· Markdown
· YAML
· <a href="https://prettier.io/docs/en/plugins.html">
JavaScript
· TypeScript
· Flow
· JSX
· JSON
</em>
<br />
<em>
CSS
· SCSS
· Less
</em>
<br />
<em>
HTML
· Vue
· Angular
</em>
<br />
<em>
GraphQL
· Markdown
· YAML
</em>
<br />
<em>
<a href="https://prettier.io/docs/en/plugins.html">
Your favorite language?
</a>
</em>

View File

@ -53,6 +53,25 @@ matrix(
</div>
```
## HTML
```html
<!-- prettier-ignore -->
<div class="x" >hello world</div >
<!-- prettier-ignore-attribute -->
<div
(mousedown)=" onStart ( ) "
(mouseup)=" onEnd ( ) "
></div>
<!-- prettier-ignore-attribute (mouseup) -->
<div
(mousedown)="onStart()"
(mouseup)=" onEnd ( ) "
></div>
```
## CSS
```css

View File

@ -191,13 +191,12 @@ Valid options:
- `"json-stringify"` (same parser as `"json"`, but outputs like `JSON.stringify`) _Since v1.13.0_
- `"graphql"` (via [graphql/language](https://github.com/graphql/graphql-js/tree/master/src/language)) _Since v1.5.0_
- `"markdown"` (via [remark-parse](https://github.com/wooorm/remark/tree/master/packages/remark-parse)) _Since v1.8.0_
- `"vue"` (uses several parsers) _Since 1.10.0_
- `"mdx"` (via [remark-parse](https://github.com/wooorm/remark/tree/master/packages/remark-parse) and [@mdx-js/mdx](https://github.com/mdx-js/mdx/tree/master/packages/mdx)) _Since v1.15.0_
- `"html"` (via [angular-html-parser](https://github.com/ikatyang/angular-html-parser/tree/master/packages/angular-html-parser)) _Since 1.15.0_
- `"vue"` (same parser as `"html"`, but also formats vue-specific syntax) _Since 1.10.0_
- `"angular"` (same parser as `"html"`, but also formats angular-specific syntax via [angular-estree-parser](https://github.com/ikatyang/angular-estree-parser)) _Since 1.15.0_
- `"yaml"` (via [yaml](https://github.com/eemeli/yaml) and [yaml-unist-parser](https://github.com/ikatyang/yaml-unist-parser)) _Since 1.14.0_
<!-- TODO: Uncomment and move below "markdown" above when 1.15.0 is released.
- `"mdx"` (same parser as `"markdown"`, with some custom overrides) _Since 1.15.0_
-->
[Custom parsers](api.md#custom-parser-api) are also supported. _Since v1.5.0_
| Default | CLI Override | API Override |
@ -272,7 +271,23 @@ Valid options:
| ------------ | ----------------------------------------------------------- | ----------------------------------------------------------- |
| `"preserve"` | <code>--prose-wrap <always&#124;never&#124;preserve></code> | <code>proseWrap: "<always&#124;never&#124;preserve>"</code> |
<!--TODO(1.15)
## HTML Whitespace Sensitivity
_available in v1.15.0+_
Specify the global whitespace sensitivity for HTML files, see [whitespace-sensitive formatting] for more info.
[whitespace-sensitive formatting]: https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting
Valid options:
- `"css"` - Respect the default value of CSS `display` property.
- `"strict"` - Whitespaces are considered sensitive.
- `"ignore"` - Whitespaces are considered insensitive.
| Default | CLI Override | API Override |
| ------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------------- |
| `"css"` | <code>--html-whitespace-sensitivity <css&#124;strict&#124;ignore></code> | <code>htmlWhitespaceSensitivity: "<css&#124;strict&#124;ignore>"</code> |
## End of Line
@ -310,6 +325,4 @@ Valid options:
| Default | CLI Override | API Override |
| -------- | ----------------------------------------------------------- | ---------------------------------------------------------- |
| `"auto"` | <code>--end-of-line <auto&#124;cr&#124;crlf&#124;lf></code> | <code>endOfLine: "<auto&#124;cr&#124;crlf&#124;lf>"</code> |
-->
| `"auto"` | <code>--end-of-line <auto&#124;lf&#124;crlf&#124;cr></code> | <code>endOfLine: "<auto&#124;lf&#124;crlf&#124;cr>"</code> |

File diff suppressed because it is too large Load Diff

View File

@ -6,8 +6,14 @@
- "[`JSX`](https://facebook.github.io/jsx/)"
- "[`Flow`](https://flow.org/)"
- "[`TypeScript`](https://www.typescriptlang.org/)"
- "[`Vue`](https://vuejs.org/)"
- "[`JSON`](http://json.org/)"
- name: HTML
showName: false
image: /images/languages/tools_html.svg
variants:
- "`HTML5`"
- "[`Vue`](https://vuejs.org/)"
- "[`Angular`](https://angular.io/)"
- name: CSS
showName: false
image: /images/languages/tools_css.svg

View File

@ -0,0 +1,22 @@
<!--
This icon is modified from https://github.com/PKief/vscode-material-icon-theme/blob/7143ec2/icons/html.svg
The MIT License (MIT)
Copyright (c) 2018 Philipp Kief
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<svg version="1.1" viewBox="4.1 2.5 15.65 20" xmlns="http://www.w3.org/2000/svg">
<path
fill="#C695C8"
d="
m12 17.56l4.07-1.13.55-6.1h-7.24l-.18-2.03h7.6l.2-1.99h-10l.56 6.01h6.89l-.23 2.58-2.22.6-2.22-.6-.14-1.66h-2l.29 3.19 4.07 1.13
m-7.93-14.56h15.86l-1.43 16.2-6.5 1.8-6.5-1.8-1.43-16.2z
"
/>
</svg>

View File

@ -117,15 +117,8 @@ var parsers = {
},
// Vue
get vue() {
// TODO(1.15): remove this workaround
// parser-vue is replaced by parser-html in 1.15+
try {
importScriptOnce("lib/parser-vue.js");
return prettierPlugins.vue.parsers.vue;
} catch (e) {
importScriptOnce("lib/parser-html.js");
return prettierPlugins.html.parsers.vue;
}
importScriptOnce("lib/parser-html.js");
return prettierPlugins.html.parsers.vue;
},
// Angular
get angular() {