Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Core Grammars:
- fix(diff) fix unified diff hunk header regex to allow unpaired numbers [Chris Wilson][]
- enh(php) support single line and hash comments in attributes, constructor and functions [Antoine Musso][]
- enh(json) add json5 support [Kerry Shetline][]
- fix(css) `unicode-range` parsing, issue #4253 [Kerry Shetline][]

Documentation:

Expand All @@ -39,15 +40,14 @@ CONTRIBUTORS
[Chris Wilson]: https://github.com/sushicw
[Antoine Musso]: https://github.com/hashar
[Chester Moses]: https://github.com/Chester-Moses-HCL
[Kerry Shetline]: https://github.com/kshetline
[SungHyun Kim]: https://github.com/witch-factory
[Adam Lui]: https://github.com/adamlui
[Sebastiaan Speck]: https://github.com/sebastiaanspeck
[Filip Hoffmann]: https://github.com/folospior
[Kerry Shetline]: https://github.com/kshetline
[Twineee1]: https://github.com/Twineee1
[hbgl]: https://github.com/hbgl


## Version 11.11.1

- Fixes regression with Rust grammar.
Expand Down
3 changes: 2 additions & 1 deletion src/languages/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ export default function(hljs) {
modes.HEXCOLOR,
modes.IMPORTANT,
modes.CSS_NUMBER_MODE,
modes.UNICODE_RANGE,
...STRINGS,
// needed to highlight these as strings and to avoid issues with
// illegal characters that might be inside urls that would tigger the
// illegal characters that might be inside urls that would trigger the
// languages illegal stack
{
begin: /(url|data-uri)\(/,
Expand Down
3 changes: 2 additions & 1 deletion src/languages/less.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default function(hljs) {
excludeEnd: true
}
},
modes.UNICODE_RANGE,
modes.HEXCOLOR,
PARENS_MODE,
IDENT_MODE('variable', '@@?' + IDENT_RE, 10),
Expand Down Expand Up @@ -177,7 +178,7 @@ export default function(hljs) {
MIXIN_GUARD_MODE,
IDENT_MODE('keyword', 'all\\b'),
IDENT_MODE('variable', '@\\{' + IDENT_RE + '\\}'), // otherwise it’s identified as tag

{
begin: '\\b(' + css.TAGS.join('|') + ')\\b',
className: 'selector-tag'
Expand Down
5 changes: 5 additions & 0 deletions src/languages/lib/css-shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export const MODES = (hljs) => {
scope: 'number',
begin: /#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/
},
UNICODE_RANGE: {
scope: 'number',
begin: /\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,4}(-[0-9A-Fa-f][0-9A-Fa-f]{0,4})?/
},
FUNCTION_DISPATCH: {
className: "built_in",
begin: /[\w-]+(?=\()/
Expand Down Expand Up @@ -777,6 +781,7 @@ export const ATTRIBUTES = [
'transition-timing-function',
'translate',
'unicode-bidi',
'unicode-range',
'user-modify',
'user-select',
'vector-effect',
Expand Down
1 change: 1 addition & 0 deletions src/languages/scss.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export default function(hljs) {
VARIABLE,
modes.HEXCOLOR,
modes.CSS_NUMBER_MODE,
modes.UNICODE_RANGE,
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
modes.IMPORTANT,
Expand Down
1 change: 1 addition & 0 deletions src/languages/stylus.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export default function(hljs) {
VARIABLE,
hljs.APOS_STRING_MODE,
modes.CSS_NUMBER_MODE,
modes.UNICODE_RANGE,
hljs.QUOTE_STRING_MODE
]
}
Expand Down
2 changes: 1 addition & 1 deletion test/markup/css/css_consistency.expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<span class="hljs-attribute">font-variant</span>: no-common-ligatures proportional-nums;
<span class="hljs-attribute">font-feature-settings</span>: <span class="hljs-string">&quot;liga&quot;</span> <span class="hljs-number">0</span>;
<span class="hljs-attribute">font-variation-settings</span>: <span class="hljs-string">&quot;xhgt&quot;</span> <span class="hljs-number">0.7</span>;
<span class="hljs-comment">/* unicode-range: U+0025-00FF, U+4??; */</span>
<span class="hljs-attribute">unicode-range</span>: <span class="hljs-number">U+0025-00FF</span>, <span class="hljs-number">U+4??</span>;
<span class="hljs-comment">/* it&#x27;s not 100% clear how url and format should be highlighted universally */</span>
<span class="hljs-comment">/* src: url(&quot;/fonts/OpenSans-Regular-webfont.woff2&quot;) format(&quot;woff2&quot;),
url(&quot;/fonts/OpenSans-Regular-webfont.woff&quot;) format(&quot;woff&quot;); */</span>
Expand Down
2 changes: 1 addition & 1 deletion test/markup/css/css_consistency.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ a[href*="example"] {}
font-variant: no-common-ligatures proportional-nums;
font-feature-settings: "liga" 0;
font-variation-settings: "xhgt" 0.7;
/* unicode-range: U+0025-00FF, U+4??; */
unicode-range: U+0025-00FF, U+4??;
/* it's not 100% clear how url and format should be highlighted universally */
/* src: url("/fonts/OpenSans-Regular-webfont.woff2") format("woff2"),
url("/fonts/OpenSans-Regular-webfont.woff") format("woff"); */
Expand Down
2 changes: 1 addition & 1 deletion test/markup/less/css_consistency.expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<span class="hljs-attribute">font-variant</span>: no-common-ligatures proportional-nums;
<span class="hljs-attribute">font-feature-settings</span>: <span class="hljs-string">&quot;liga&quot;</span> <span class="hljs-number">0</span>;
<span class="hljs-attribute">font-variation-settings</span>: <span class="hljs-string">&quot;xhgt&quot;</span> <span class="hljs-number">0.7</span>;
<span class="hljs-comment">/* unicode-range: U+0025-00FF, U+4??; */</span>
<span class="hljs-attribute">unicode-range</span>: <span class="hljs-number">U+0025-00FF</span>, <span class="hljs-number">U+4??</span>;
<span class="hljs-comment">/* it&#x27;s not 100% clear how url and format should be highlighted universally */</span>
<span class="hljs-comment">/* src: url(&quot;/fonts/OpenSans-Regular-webfont.woff2&quot;) format(&quot;woff2&quot;),
url(&quot;/fonts/OpenSans-Regular-webfont.woff&quot;) format(&quot;woff&quot;); */</span>
Expand Down
2 changes: 1 addition & 1 deletion test/markup/less/css_consistency.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ a[href*="example"] {}
font-variant: no-common-ligatures proportional-nums;
font-feature-settings: "liga" 0;
font-variation-settings: "xhgt" 0.7;
/* unicode-range: U+0025-00FF, U+4??; */
unicode-range: U+0025-00FF, U+4??;
/* it's not 100% clear how url and format should be highlighted universally */
/* src: url("/fonts/OpenSans-Regular-webfont.woff2") format("woff2"),
url("/fonts/OpenSans-Regular-webfont.woff") format("woff"); */
Expand Down
2 changes: 1 addition & 1 deletion test/markup/scss/css_consistency.expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<span class="hljs-attribute">font-variant</span>: no-common-ligatures proportional-nums;
<span class="hljs-attribute">font-feature-settings</span>: <span class="hljs-string">&quot;liga&quot;</span> <span class="hljs-number">0</span>;
<span class="hljs-attribute">font-variation-settings</span>: <span class="hljs-string">&quot;xhgt&quot;</span> <span class="hljs-number">0.7</span>;
<span class="hljs-comment">/* unicode-range: U+0025-00FF, U+4??; */</span>
<span class="hljs-attribute">unicode-range</span>: <span class="hljs-number">U+0025-00FF</span>, <span class="hljs-number">U+4??</span>;
<span class="hljs-comment">/* it&#x27;s not 100% clear how url and format should be highlighted universally */</span>
<span class="hljs-comment">/* src: url(&quot;/fonts/OpenSans-Regular-webfont.woff2&quot;) format(&quot;woff2&quot;),
url(&quot;/fonts/OpenSans-Regular-webfont.woff&quot;) format(&quot;woff&quot;); */</span>
Expand Down
2 changes: 1 addition & 1 deletion test/markup/scss/css_consistency.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ a[href*="example"] {}
font-variant: no-common-ligatures proportional-nums;
font-feature-settings: "liga" 0;
font-variation-settings: "xhgt" 0.7;
/* unicode-range: U+0025-00FF, U+4??; */
unicode-range: U+0025-00FF, U+4??;
/* it's not 100% clear how url and format should be highlighted universally */
/* src: url("/fonts/OpenSans-Regular-webfont.woff2") format("woff2"),
url("/fonts/OpenSans-Regular-webfont.woff") format("woff"); */
Expand Down
2 changes: 1 addition & 1 deletion test/markup/stylus/css_consistency.expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<span class="hljs-attribute">font-variant</span>: no-common-ligatures proportional-nums;
<span class="hljs-attribute">font-feature-settings</span>: <span class="hljs-string">&quot;liga&quot;</span> <span class="hljs-number">0</span>;
<span class="hljs-attribute">font-variation-settings</span>: <span class="hljs-string">&quot;xhgt&quot;</span> <span class="hljs-number">0.7</span>;
<span class="hljs-comment">/* unicode-range: U+0025-00FF, U+4??; */</span>
<span class="hljs-attribute">unicode-range</span>: U+<span class="hljs-number">0025</span>-<span class="hljs-number">00</span>FF, U+<span class="hljs-number">4</span>??;
<span class="hljs-comment">/* it&#x27;s not 100% clear how url and format should be highlighted universally */</span>
<span class="hljs-comment">/* src: url(&quot;/fonts/OpenSans-Regular-webfont.woff2&quot;) format(&quot;woff2&quot;),
url(&quot;/fonts/OpenSans-Regular-webfont.woff&quot;) format(&quot;woff&quot;); */</span>
Expand Down
2 changes: 1 addition & 1 deletion test/markup/stylus/css_consistency.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ a[href*="example"] {}
font-variant: no-common-ligatures proportional-nums;
font-feature-settings: "liga" 0;
font-variation-settings: "xhgt" 0.7;
/* unicode-range: U+0025-00FF, U+4??; */
unicode-range: U+0025-00FF, U+4??;
/* it's not 100% clear how url and format should be highlighted universally */
/* src: url("/fonts/OpenSans-Regular-webfont.woff2") format("woff2"),
url("/fonts/OpenSans-Regular-webfont.woff") format("woff"); */
Expand Down