zsitro
zsitro

Reputation: 1892

Sublime Text 2 HTML5 syntax highlight

Im using sublime to edit html5 docs. But when I started to do quote-free editing like:

<div id=asdf>

instead of

<div id="asdf">

its syntax highlight gone crazy.

enter image description here

Any ideas how to solve this? Is there other up to date parser for sublime?

ty

Upvotes: 5

Views: 4697

Answers (3)

Cory Gagliardi
Cory Gagliardi

Reputation: 780

This Sublime Text thread suggests a way to fix it: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=8129

Open up your HTML.tmLanguage (in ~/.config/sublime-text-2/Packages/HTML) and look for this:

  <string>(?&lt;='|")</string>
  <key>name</key>
  <string>meta.attribute-with-value.id.html</string>

Change the first line to

<string>(?&lt;==|='|=")</string>

Your unquoted values won't be highlighted in the same way that quoted values are highlighted, but it will at least prevent the syntax highlighting from completely breaking.

Upvotes: 5

Josh Campbell
Josh Campbell

Reputation: 458

I have to go with Dbugger on this one. I feel compelled not to assist in helping you configure Sublime to "not report" bad HTML practices. With that said, the answer to your question is- typing in the quotations will eliminate the weird highlighting in Sublime.

Upvotes: -1

Enrique Moreno Tent
Enrique Moreno Tent

Reputation: 25307

Quote free html is not a good idea. I recommend you to use quotes. The bytes you will save are not worth the aggravation is going to cost you.

Upvotes: 3

Related Questions