Closed aral closed 3 months ago
Can you show me an article or anything that might suggest this is as prolific a "standard" as uppercase class names in JS? We do in several cases highlight idiomatic code (past the syntax itself) - but I'm not certain this yet rises to that same level...
I find this functionality was originally added with:
it's becoming common to write inline HTML and CSS as tagged template literals
I'm not even sure the original support rises to the bar honestly... but this was before my time... Typically our policy is to highlight things that matter syntactically... for example CSS inside a <script>
tag in HTML should be highlighted as CSS - it literally is - as understood by every web browser in existence. CSS inside a css``
template string is not syntactically CSS - it's purely a string.
@allejo Any thoughts here? Am I being to string in my thinking?
Can you show me an article or anything that might suggest this is as prolific a "standard" as uppercase class names in JS? We do in several cases highlight idiomatic code (past the syntax itself) - but I'm not certain this yet rises to that same level...
I’m not sure about any articles but the TypeScript Language Server (used in VSCode, etc.) correctly handles these.
e.g., screenshot from VSCode:
And ditto for CSS:
Is it matching on anythingatall.html``
- or does it only work for kitten?
@joshgoebel On anything at all; I don’t think Microsoft know or care about Kitten ;)
Is your request related to a specific problem you're having?
Kitten exposes
html
andcss
tagged template strings not from the global namespace but fromglobalThis.kitten
(so as not to pollute the global namespace).e.g.,
Currently, highlight.js does not recognise and highlight these as HTML.
The solution you'd prefer / feature you'd like to see added...
I’d love to see the HTML and CSS tagged template string match criteria expanded so they match
.html
and.css
, not justhtml
andcss
so that, for examplewould also be recognised as HTML.
Any alternative solutions you considered...
Leaving a space after the dot works since JavaScript is whitespace agnostic but it looks and feels wrong to have to do that just to make the syntax highlighter happy :)