Better syntax highlighting for html-like template literals


#1

Could we get better syntax highlighting for html inside tagged template literals?

See, no code for html elements.


#2

For reference, compare to GitHub.


#3

Hi Jorge,

Thanks for the suggestion :sunglasses:

We’re using the stock syntax highlighting from Code Mirror, so their GitHub repo might be a better place for that request. If the syntax highlighting on their demo page does a better job than Gomix, let us know and we’ll double-check that we’ve got the most up-to-date version :sparkles:


#4

I had a similar request, both for syntax highlighting, but also for general editor functionality with template literals. Maybe it’s not possible because a string could be literally anything but there are a lot of libraries, yo-yo for instance, that use the literal to pass HTML around. When you are doing this it breaks indentation and other common HTML features that are present normally. That’s a tough one maybe but it would be an awesome feature for anyone using modern lightweight JS libs like Choo or Yo-Yo


#5

Hi Paul,

At least for jsx, there is this workaround I wrote about in a different post: Syntax highlighting for jsx in .js files?, which basically sets the syntax highlight to jsx for javascript files.

Let us know if you find it useful :slight_smile: