Sublime Text 3 - indentation after self-closing HTML5 tag

I'm writing HTML5 in Sublime Text 3 and not explicitly closing self-closing tags, i.e.

<nav>
  <image src="assets/apps-btn.png">
  <image src="assets/navbar-logo.png">
</nav>

However, Sublime Text 3 is indenting automatically and expecting me to explicitly close these tags, generating the closing tag </image> when I type </ to close the <nav> tag with </nav>, i.e.

<nav>
	<image src="assets/apps-btn.png">
	</image>
		<image src="assets/navbar-logo.png">
		</image>
		</nav>

Can anyone tell me how to change this please? I still want to use auto-indentation, but want to change how Sublime Text 3 treats self-closing tags.

1 answer

  • answered 2018-01-14 11:41 Quentin

    There is no such thing as an <image> element in HTML, so the parsing rules (for unknown elements) mean that the end tag is required.

    If you use an element where the end tag is forbidden (such as <img>) then you should see the correct indentation.