-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
Prettier 1.18.2
Playground link
--html-whitespace-sensitivity strict
--parser htmlInput:
<html>
<body>
<script
async=""
id=""
src="/_next/static/development/pages/_app.js?ts=1565732195968"
></script><script></script>
</body>
</html>Output:
<html>
<body>
<script
async=""
id=""
src="/_next/static/development/pages/_app.js?ts=1565732195968"
></script
><script></script>
</body>
</html>Expected behavior:
There are several previous GH issues about HTML whitespacing sensitivity, which seem to be related to this but not quite the same. There's also https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting.
For the above input, the output for css and strict are the same. For this case, prettier adds an extra newline for </script><script></script>, and borrows the closing > while doing so.
This looks like an incorrect result. I expected either <script></script> on a newline (without the borrowed >), or for the input HTML to remain unmodified (when using strict).
This output is also problematic for syntax highlighters. You can see this happening in Github's highlighting for the text above.