Skip to content

Commit

Permalink
feat(css): handle css variables syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
thanoskrg committed Jun 12, 2021
1 parent 40b6a8a commit f4681c3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/languages/css.js
Expand Up @@ -25,6 +25,10 @@ export default function(hljs) {
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE
];
const CSS_VARIABLE = {
className: "variable",
begin: /--[A-Za-z_-](?:(?!\s)[A-Za-z0-9_-])*/,
};

return {
name: 'CSS',
Expand Down Expand Up @@ -72,6 +76,7 @@ export default function(hljs) {
// end: /\)/,
// contains: [ hljs.CSS_NUMBER_MODE ]
// },
CSS_VARIABLE,
{
className: 'attribute',
begin: '\\b(' + css.ATTRIBUTES.join('|') + ')\\b'
Expand Down Expand Up @@ -106,7 +111,11 @@ export default function(hljs) {
}
]
},
FUNCTION_DISPATCH
FUNCTION_DISPATCH,
{
begin: /\(/,
contains: [ CSS_VARIABLE ],
}
]
},
{
Expand Down

0 comments on commit f4681c3

Please sign in to comment.