d_zero
d_zero

Reputation: 21

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.

Upvotes: 0

Views: 158

Answers (1)

Quentin
Quentin

Reputation: 943150

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.

Upvotes: 1

Related Questions