简体   繁体   English

PHPStorm HTML格式化评论

[英]PHPStorm HTML Formatting comments

I have a list of li and encountered the dreaded space between inline block elements. 我有一个li列表,遇到了内联块元素之间的可怕空间。 My quick fix is to utilize the comment trick, all works well but once I format the code with PHPStorm the comments are no longer being placed correctly. 我的快速解决方法是利用评论技巧,一切正常,但一旦我使用PHPStorm格式化代码,评论就不再正确放置。 Is there anyway I can configure this in PHPStorm? 无论如何我可以在PHPStorm中配置它吗? An example of what happens is shown below. 发生的事情的一个例子如下所示。

<li>Hello</li><!--
--><li>Second</li>

What ends up happening is 最终发生的事情是

<li>Hello</li>
<!--
           -->
<li>Second</li>

I can only suggest disabling formatting for such blocks, like: 我只能建议禁用这些块的格式,例如:

<!--@formatter:off-->
<li>Hello</li><!--
--><li>Second</li>
<!--@formatter:on-->

You would also need to make sure to enable formatter markers in Settings/Editor/Code Style , Enable formatter markers in comments 您还需要确保在Settings/Editor/Code StyleEnable formatter markers in comments

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

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