小编LeK*_*oid的帖子

如何强制在新行上关闭HTML标签?

在VS Code中,我广泛使用Beautify。但是令我不安的是,结束标记始终与“浮动”文本或自动闭合标记位于同一行。例如,在Beautify之前:

<div class="wrap">
    <img src="/wp-content/uploads/2018/08/image.png">
</div>
<div class="wrap">This is just some text
    <strong>but it needs to be emphasized</strong>! And then some...
</div>
Run Code Online (Sandbox Code Playgroud)

在Beautify之后:

<div class="wrap">
    <img src="/wp-content/uploads/2018/08/image.png"> </div>
<div class="wrap">This is just some text
    <strong>but it needs to be emphasized</strong>! And then some... </div>
Run Code Online (Sandbox Code Playgroud)

是否有设置或其他扩展名可以帮助使代码更接近第一个示例中的外观?或者我只是做错了什么?

在大多数时候,这并不重要,除了让我感到有点丑陋外,但是昨天我看到它实际上在Wordpress中造成了问题,我只是不能再使用Beautify,否则就有可能破坏格式。

html js-beautify visual-studio-code

7
推荐指数
1
解决办法
970
查看次数

标签 统计

html ×1

js-beautify ×1

visual-studio-code ×1