Skip to content

Commit

Permalink
fix(css/scss) single-colon psuedo-elements no longer break highlighti…
Browse files Browse the repository at this point in the history
…ng (#3321)
  • Loading branch information
joshgoebel committed Oct 7, 2021
1 parent 1fa2a16 commit 0e0e7b2
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Expand Up @@ -12,6 +12,8 @@ Parser:

Grammars:

- fix(css) single-colon psuedo-elements no longer break highlighting (#3240) [Josh Goebel][]
- fix(scss) single-colon psuedo-elements no longer break highlighting (#3240) [Josh Goebel][]
- enh(fsharp) rewrite most of the grammar, with many improvements [Melvyn Laïly][]
- enh(go) better type highlighting, add `error` type [Josh Goebel][]
- fix(js/ts) regex inside `SUBST` is no longer highlighted [Josh Goebel][]
Expand Down
4 changes: 2 additions & 2 deletions src/languages/css.js
Expand Up @@ -75,8 +75,8 @@ export default function(hljs) {
},
// attribute values
{
begin: ':',
end: '[;}]',
begin: /:/,
end: /[;}{]/,
contains: [
modes.BLOCK_COMMENT,
modes.HEXCOLOR,
Expand Down
4 changes: 2 additions & 2 deletions src/languages/scss.js
Expand Up @@ -72,8 +72,8 @@ export default function(hljs) {
begin: '\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b'
},
{
begin: ':',
end: ';',
begin: /:/,
end: /[;}{]/,
contains: [
modes.BLOCK_COMMENT,
VARIABLE,
Expand Down
11 changes: 11 additions & 0 deletions test/markup/css/pseudo.expect.txt
@@ -0,0 +1,11 @@
<span class="hljs-selector-class">.test</span>:before,
.test:after {
<span class="hljs-attribute">color</span>: pink;
<span class="hljs-attribute">color</span>: red;
}

<span class="hljs-selector-class">.test</span><span class="hljs-selector-pseudo">::before</span>,
<span class="hljs-selector-class">.test</span><span class="hljs-selector-pseudo">::after</span> {
<span class="hljs-attribute">color</span>: pink;
<span class="hljs-attribute">color</span>: red;
}
11 changes: 11 additions & 0 deletions test/markup/css/pseudo.txt
@@ -0,0 +1,11 @@
.test:before,
.test:after {
color: pink;
color: red;
}

.test::before,
.test::after {
color: pink;
color: red;
}
2 changes: 1 addition & 1 deletion test/markup/scss/default.expect.txt
Expand Up @@ -40,7 +40,7 @@
<span class="hljs-selector-tag">ul</span> {
<span class="hljs-attribute">width</span>: <span class="hljs-number">100%</span>;
<span class="hljs-attribute">padding</span>: {
left: <span class="hljs-number">5px</span>; <span class="hljs-attribute">right</span>: <span class="hljs-number">5px</span>;
<span class="hljs-attribute">left</span>: <span class="hljs-number">5px</span>; <span class="hljs-attribute">right</span>: <span class="hljs-number">5px</span>;
}
<span class="hljs-selector-tag">li</span> {
<span class="hljs-attribute">float</span>: left; <span class="hljs-attribute">margin-right</span>: <span class="hljs-number">10px</span>;
Expand Down

0 comments on commit 0e0e7b2

Please sign in to comment.