Reputation: 784
I was not able to find a way to make IntelliJ format HTML code consistently through inserting new lines and indents.For example, this code:
<li class="nav"><a href="/about">
About</a></li>
Should be formatted to this:
<li class="nav">
<a href="/about">About</a>
</li>
Or:
<li class="nav">
<a href="/about">
About
</a>
</li>
When I try to re-format selected text or entire file, this segment is not changed!!!
I have already tried to play with Preferences > Language > HTML > Code Style, but no success!
Upvotes: 2
Views: 1349
Reputation: 34846
This is related to Element inlining. When you look at the code style settings for HTML there is Inline elements selection. When you remove a
tag from this selection and reformat your code, the code will be arranged the way you want it (i.e. a
will not be kept on the same line as li
).
Upvotes: 3
Reputation: 1582
Navigate again to navigate to Preferences > Language > HTML > Code Style and configure as:
Then try to select the code and reformat.
Upvotes: 1