Skip to content

Commit 06255ba

Browse files
committed
fix: don't use unicodeSets regex feature, fix gradient transparency
The unicode sets / "v" flag are only supported since mid 2023; this replaces them with [a-fA-F0-9], which matches the CSS spec. https://caniuse.com/mdn-javascript_builtins_regexp_unicodesets This also fixes support for 8-character #RRGGBBAA color codes.
1 parent 14c0d5a commit 06255ba

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/Markup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ type CustomEntity = Entity & { type: "custom" };
7979

8080
const TimeOffsetRegex = /^[+-]\d{4}$/;
8181
const CustomColorExprRegex =
82-
/^(?<colors>#(?:\p{Hex_Digit}{3,4}|\p{Hex_Digit}{6,7})(?:-(?:#(?:\p{Hex_Digit}{3,4}|\p{Hex_Digit}{6,7})))+)\s+(?<text>.*)$/v;
82+
/^(?<colors>#(?:[a-fA-F0-9]{3,4}|[a-fA-F0-9]{6,8})(?:-(?:#(?:[a-fA-F0-9]{3,4}|[a-fA-F0-9]{6,8})))+)\s+(?<text>.*)$/u;
8383

8484
function transformCustomEntity(entity: CustomEntity, ctx: RenderContext) {
8585
const messages = useMessages();

0 commit comments

Comments
 (0)