Prettier 2.6.2对HTML代码做出了奇怪的更改
我是新来的。在运行Prettier之后,我在此HTML中有这种奇怪的现象:
<!DOCTYPE html>
<html>
<head>
<title>X</title>
</head><!-- ddd --->
<body></body>
</html>
然后我运行此命令:
prettier --write "./src/**/*.{ts,html,scss}"
结果是:
<!DOCTYPE html>
<html>
<head>
<title>X</title></head
><!-- ddd --->
<body></body>
</html>
我有这个.prettierrc.json文件
{
"singleQuote": true,
"trailingComma": "es5",
"endOfLine": "auto",
"bracketSpacing": true,
"printWidth": 120
}
。谢谢。
I am new to prettier. I have this strange phenomena in this HTML, after running prettier:
<!DOCTYPE html>
<html>
<head>
<title>X</title>
</head><!-- ddd --->
<body></body>
</html>
Then i run this command:
prettier --write "./src/**/*.{ts,html,scss}"
And the result is this:
<!DOCTYPE html>
<html>
<head>
<title>X</title></head
><!-- ddd --->
<body></body>
</html>
I have this .prettierrc.json file
{
"singleQuote": true,
"trailingComma": "es5",
"endOfLine": "auto",
"bracketSpacing": true,
"printWidth": 120
}
Any suggestions why this behavior occurs? Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加此选项
in命令行:
-
-
- - html-whitespace-Senititive忽略
或在您的
.prettierrc.json
中:htmlWhitespaceSentitivity:“ impan of of of of code>
Add this option
In command line :
--html-whitespace-sensitivity ignore
Or in your
.prettierrc.json
:htmlWhitespaceSensitivity: "ignore"