简体   繁体   中英

PHPStorm HTML Formatting comments

I have a list of li and encountered the dreaded space between inline block elements. 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. Is there anyway I can configure this in 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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