简体   繁体   English

更漂亮 - 禁用 html 标签的自动关闭

[英]prettier - disable auto closing of html tags

How to disable/avoid prettier to auto-close an HTML tag on formating?如何禁用/避免更漂亮地在格式化时自动关闭 HTML 标签? I tried "html.autoClosingTags": false in vs code settings.json, but It does not work.我在 vs 代码 settings.json 中尝试了"html.autoClosingTags": false ,但它不起作用。

Before formatting:格式化前:

<body>
    <h1>home page</h1>

After formatting:格式化后:

<body>
    <h1>home page</h1>
</body>

Inside your JSX the code you need:在您的 JSX 中,您需要的代码是:

{
  "javascript.autoClosingTags": false,
  "typescript.autoClosingTags": false
}

In order for your tags not to automatically close.为了您的标签不会自动关闭。 You can also adjust this in your preferences per version # 16.11.您还可以在每个版本 16.11 的首选项中进行调整。

Go to File > Preferences > Settings, search for html.转到文件 > 首选项 > 设置,搜索 html。 autoClosingTags and set it to false . autoClosingTags 并将其设置为 false 。 This will make it so when you type , it won't insert automatically, but if you start typing </ , it won't close the tag automatically.这将使您在键入时不会自动插入,但是如果您开始键入 </ ,它不会自动关闭标签。

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

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