使用"重新格式化代码"在HTML文件的IntelliJ(和其他JetBrains IDE)中,将在文本中添加换行符,以确保文本不会超出正确的边距。我正在寻找的是能够将一部分文本移回前一行,如果前一行有空格的话。
例如,如果我最初有:
<p>
This is some text that is fairly long and won't fit on a single line without going over the right margin.
</p>
重新格式化代码会产生类似的结果(假设右边距非常小):
<p>
This is some text that is fairly long and
won't fit on a single line without going
over the right margin.
</p>
但是如果我删除了一些文字:
<p>
This is some text that
won't fit on a single line without going
over the right margin.
</p>
我想重新格式化代码以自动生成:
<p>
This is some text that won't fit on a
single line without going over the right
margin.
</p>
我查看了重新格式化代码的设置,但没看到如何执行此操作。可能是其中一个&#34; Keep newlines&#34;选项,但删除它们似乎也删除标签之间的换行符。有没有办法做到这一点?