- switch to [`htmlparser2`](https://github.com/fb55/htmlparser2)
- no need to fork
- won't generate pseudo nodes ([`parse5` will](https://github.com/prettier/prettier/issues/5098#issuecomment-423055181))
- should be [faster](https://github.com/fb55/htmlparser2#performance)
- support custom self-closing tags
- support HTML entities
- remove extra trailing newline for `<template>`
- distinguish empty/empty-string attributes (`<tag x>`/`<tag x="">`)
- rename `--parser parse5` with `--parser html`
- enable `html` since 1.15, which means it's enabled by default if you install the dev version from GitHub after this PR merged.
The issue here is that the `stripTrailingHardline` does not work for js/ts, I fixed it and then I realized that we always print trailing newline in every language, so there's no need to strip newline for text in script-like tag.
* feat: html support
* fix: support empty lines between children
* refactor: isScriptTagNode util
* refactor: rename `glimmer` and `handlebars` tests
* fix don't add newline after `directive` node
* fix: support `pre` tag
* fix: don't trim comments content
* fix: `script` and `style` tags output
* feat: indent `head` and `body` inside `html`
* fix: better handle quotes around attribute value
* feat: better handle embed
* tests: svg into html
* fix: better handle boolean and empty attributes
* chore(deps): update `parse5` to latest version
* fix: better handle empty attribute
* tests: fix
* fix: extra newline in multiline node
* fix: print `pre` and `textarea` in right way
* tests: xhtml doctype
* fix: use `>` instead `/>`
* tests: case
* refactor: remove `toLowerCase()`
* feat: support `prettier-ignore`
* tests: empty `script` and `style` tags
* fix: clean
* tests: refactor and more
There're always 2 files that they're source code but not in the `src` directory, which makes it hard to search.
- move the content of `index.js` and `standalone.js` to `src`.
- `/index.js` and `/standalone.js` are preserved as links to not break builds that's installed from git.
Sometimes we need to transform the ast to make it easier to print, but it's currently done in the parser (markdown and yaml), which leads the output ast harder to use for external users (custom parser), adding `printer.preprocess` can solve this issue.
And also this way we could move the trailing newline for json from `ast-to-doc.js` to `language-js`.
* don't inline pipeline operator with leading ownline comment
* Add tests for comments surrounded with binary expressions
* Add babylon test for ownlinecomment with pipeline operator
- upgrade to `yaml@1.0.0-rc.8` and `yaml-unist-parser@1.0.0-rc.4`
- refactor some logic since the AST has slightly changed (ikatyang/yaml-unist-parser#82)
- unmatched aliases are now errors since it may introduce invalid AST from `yaml`
- rewrite the document separator (`...`/`---`) logic, this fixes some cases where it can use `---` but we printed `...`
- removed some unnecessary duplicate trailing newline
- trailing comments on `document` (`... #comment`) and `documentHead` (`--- #comment`) are preserved (i.e. they won't be moved somewhere)
So in the list, it says to use `prettier.config.js` as your file name for configuring prettier in js. But in the example it has `//.prettierrc.js`. This confused me so I tried both file names. Both these file names work to configure prettier so I updated the docs to reflect that.