Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML syntax highlighting for unquoted attributes

Regardless whether it's a good approach or not:

Is there any way to make Sublime Text able to highlight HTML syntax for unquoted attributes? i.e

<div class=foo data-label=bar>

I have managed to fix the issue which causes unquoted id attributes to break the syntax across the document by following these instructions.

However this still not allowing syntax highlighting for unquoted attributes which is what I am after.

Any ideas?

like image 989
zanona Avatar asked Feb 14 '23 11:02

zanona


1 Answers

The reason unquoted attribute value syntax highlighting is not working is because Sublime is looking for a quoted string. Without quotes, none of the string regexes match. To work around this, you'll have to add a new scope entity.other.attribute-value.html that is included in meta.tag, begins matching at an =, matches [0-9a-zA-Z-_] one or more times, and stops matching at whitespace or >. You can then add this new scope to your color scheme and highlight it appropriately.

like image 181
MattDMo Avatar answered Feb 17 '23 03:02

MattDMo