Skip to content

fix(css): extend unicode-range regex to support 6-digit hex values#4406

Open
xxiaoxiong wants to merge 1 commit into
highlightjs:mainfrom
xxiaoxiong:fix/css-unicode-range-4253
Open

fix(css): extend unicode-range regex to support 6-digit hex values#4406
xxiaoxiong wants to merge 1 commit into
highlightjs:mainfrom
xxiaoxiong:fix/css-unicode-range-4253

Conversation

@xxiaoxiong
Copy link
Copy Markdown

Changes

Extended the UNICODE_RANGE regex in css-shared.js to support hex values up to 6 digits (e.g., U+10FFFF, U+0-10FFFF). The previous regex limited hexadecimal digits to 5 positions, causing values like U+10FFFF to be truncated to U+10FFF.

Changed {0,4} to {0,5} in both the prefix and suffix of the unicode range pattern to comply with the CSS spec which supports 1–6 digit hex values.

Related Issue

Closes #4253

Testing

Verified the fix with:

  • U+0-10FFFF (full Unicode range)
  • U+000-5FF, U+1e00-1fff, U+2000-2300 (existing cases still work)
  • U+4????? (wildcards with up to 6 ?)
  • Multiple comma-separated ranges

Checklist

  • Added markup tests, or they don't apply here because this is a regex-only change
  • Updated the changelog at CHANGES.md

The UNICODE_RANGE regex in css-shared.js limited hex values to a
maximum of 5 digits (1 + {0,4}) for both the prefix and suffix of
a unicode range. CSS unicode-range supports hex values up to 6
digits (e.g., U+10FFFF, U+0-10FFFF).

Updated {0,4} to {0,5} to properly match these longer values.

Fixes highlightjs#4253
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(CSS) unicode-range keyword not supported

1 participant