Highlighting HTML inside a JavaScript template tag

Hey there,

Is there any sort of extension like Lit-HTML in the collection? I can’t seem to find one. If not, can I commission one? :grin:


When doing straight-up Web Components, or doing tough projects where, say, a framework is being mixed with raw HTML/JS (and I’m sure a few other use cases I don’t know about), the standard way of laying down the HTML skeleton before connecting to it with JavaScript is something like:

myComponent.innerHTML = html `
<div class=thing>
    Some things.

So that’s a template tag followed by zero or one space, then whatever’s inside the template literal (inside the tildes) is HTML. It’d be nice to see it highlighted as such!

I’m not sure if this is something that’d have to be added to the existing built-in JavaScript syntax, or something that can ride along with whatever syntax you’ve already selected…

Anyways, thanks for reading.

1 Like