i’m on build 4200. in javascript highlighting, template literals tagged with a tag called “html” get special treatment, in that their contents get highlighted as HTML.
however, this breaks horribly when an html`` literal is nested inside another:
I appreciate that getting arbitrarily-nesting syntax highlighting working here is complex, but is there any chance we can at least avoid completely breaking highlighting for the rest of the file? whether automatically by detecting when this happens or at least by providing some mechanism to opt out of this special behavior for html``.
I don’t always have complete control over the coding conventions used in the files I open, so “just don’t do that” is not exactly actionable. the current behavior produces obviously broken highlighting for obviously syntactically valid javascript, which seems like an odd default.
I’d also love if there was support for the same HTML highlighting for svg. An svg literal creates elements in the SVG namespace, and many libraries such as Observable’s Hypertext Literal and the popular Lit web component library use it.
That’s fantastic, thank you. Do you think it’d be possible to make svg``highlight the same as html``? i think that’s all i was asking about in the second part of my question, since the only real difference between the two is what namespace the elements are created in; they both accept the exact same syntax.