简体   繁体   English

格式化 html 代码时 Prettier 代码格式化程序不一致

[英]Prettier code formatter inconsistency when formatting html code

I've been running into this issue there the Prettier code formatter isn't formatting my HTML code consistently in VS Code as seen below.我一直遇到这个问题,Prettier 代码格式化程序没有在 VS Code 中一致地格式化我的 HTML 代码,如下所示。 I expect it to format both of the <input> tags the same but for some reason, it splits each attribute of the second <input> into separate lines.我希望它将两个<input>标记的格式相同,但由于某种原因,它将第二个<input>的每个属性拆分为单独的行。

更漂亮的问题

Any particular reason why this is happening, if so how can I fix it so that it's consistent with the formatting of the first <input> tag?发生这种情况的任何特定原因,如果是这样,我该如何解决它以使其与第一个<input>标记的格式一致?

this happens because it has line length limit which is by default 80. you can search <Prettier: Print Width> in VS Code settings and change its value.发生这种情况是因为它的行长限制默认为 80。您可以在 VS Code 设置中搜索 <Prettier: Print Width> 并更改其值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM