You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CSS class and ID selectors contain arbitrary strings (e.g. .myclassname), which can contain escaped special characters (e.g. .foo\:myclassname to match class="foo:myclassname"). Currently, the backslash that escapes a special character is not recognised by highlight.js as a valid part of the class name or ID.
The escaped special characters (\:) should not interfere with the highlighting of the class name, but actual pseudoclasses (:hover) should still be highlighted.
GitHub:
VS Code:
Additional context
TailwindCSS makes extensive use of escaped characters in CSS selectors for its modifiers.
Other special characters are escaped for features like color opacity:
Probably need to push a proper CLASS_NAME_RE down into css-shared.js where it can then be shared with all the css-like grammars.
Anyone wanting to pick this up will need to take a look at tools/css. (helps with CSS testing). We require that all our css-like grammars remain consistent, so a patch here would need to fix all 4 grammars, not just CSS.
Probably need to push a proper CLASS_NAME_RE down into css-shared.js where it can then be shared with all the css-like grammars.
Anyone wanting to pick this up will need to take a look at tools/css. (helps with CSS testing). We require that all our css-like grammars remain consistent, so a patch here would need to fix all 4 grammars, not just CSS.
A PR would be welcome.
i believe i have a fix for this please review @joshgoebel
Describe the issue
CSS class and ID selectors contain arbitrary strings (e.g.
.myclassname
), which can contain escaped special characters (e.g..foo\:myclassname
to matchclass="foo:myclassname"
). Currently, the backslash that escapes a special character is not recognised by highlight.js as a valid part of the class name or ID.Which language seems to have the issue?
css
Are you using
highlight
orhighlightAuto
?highlight
Sample Code to Reproduce
Current highlighting:
Expected behavior
The escaped special characters (
\:
) should not interfere with the highlighting of the class name, but actual pseudoclasses (:hover
) should still be highlighted.GitHub:
VS Code:
Additional context
TailwindCSS makes extensive use of escaped characters in CSS selectors for its modifiers.
Other special characters are escaped for features like color opacity:
…and arbitrary values:
The text was updated successfully, but these errors were encountered: