IntelliJ is not formatting HTML

html, intellij-idea

Solution

Had the same problem, the statements under the tag were not indented by default. Reformatting and auto-indentation worked after I changed the following:

Settings -> Editor -> Code Style -> HTML -> Other (tab) -> Do not indent children of: -> remove "body" from the list.

Maybe it is the same for you or something related at this section. Hope it works for you aswell.

Problem

Have been using IntelliJ for years, and been happy and hope this is a fluke. IntelliJ is not formatting HTML code when I do Ctrl-Alt-L. The dialog pops, and it pretends to format, but no code is actually moved. I switched extension of the file from HTML to XML, and formatting worked as expected. Actually I noticed this in Freemarker templates, but then experimented with pure HTML with the same results. My version is 13.0.2

Original source

Related problems