Skip to content

Commit a1a1235

Browse files
authored
fix(css) variable '_' detection #3823 (#3863)
1 parent 2708bf9 commit a1a1235

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Core Grammars:
4141
- fix(swift) `warn_unqualified_access` is an attribute [Bradley Mackey][]
4242
- enh(swift) macro attributes are highlighted as keywords [Bradley Mackey][]
4343
- enh(stan) updated for version 2.33 (#3859) [Brian Ward][]
44+
- fix(css) added '_' css variable detection [Md Saad Akhtar][]
4445

4546
Dev tool:
4647

@@ -64,7 +65,7 @@ Dev tool:
6465
[Nicholas Thompson]: https://github.com/NAThompson
6566
[Yasith Deelaka]: https://github.com/YasithD
6667
[Brian Ward]: https://github.com/WardBrian
67-
68+
[Md Saad Akhtar]: https://github.com/akhtarmdsaad
6869

6970
## Version 11.8.0
7071

src/languages/lib/css-shared.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const MODES = (hljs) => {
3838
},
3939
CSS_VARIABLE: {
4040
className: "attr",
41-
begin: /--[A-Za-z][A-Za-z0-9_-]*/
41+
begin: /--[A-Za-z_][A-Za-z0-9_-]*/
4242
}
4343
};
4444
};

test/markup/css/variables.expect.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@
77
<span class="hljs-attr">--textBlue</span>: blue;
88
<span class="hljs-attribute">color</span>: <span class="hljs-built_in">var</span>(--textBlue);
99
}
10+
11+
<span class="hljs-selector-tag">body</span> {
12+
<span class="hljs-attr">--_margin-top</span>: <span class="hljs-number">1rem</span>;
13+
<span class="hljs-attribute">margin-top</span>: <span class="hljs-built_in">var</span>(--_margin-top);
14+
}

test/markup/css/variables.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ body {
77
--textBlue: blue;
88
color: var(--textBlue);
99
}
10+
11+
body {
12+
--_margin-top: 1rem;
13+
margin-top: var(--_margin-top);
14+
}
15+

0 commit comments

Comments
 (0)