mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-13 15:08:39 +00:00
Require \[text]color HTML colors to be well-formed. (#827)
Previously, the parser accepted all letters of the alphabet for hex digits in HTML colors, and allowed any number of digits. Now, only well-formed HTML hex colors are allowed.
This commit is contained in:
committed by
Kevin Barabash
parent
2fbb2b0128
commit
be60165bb1
@@ -773,7 +773,7 @@ class Parser {
|
||||
if (!res) {
|
||||
return null;
|
||||
}
|
||||
const match = (/^(#[a-z0-9]+|[a-z]+)$/i).exec(res.text);
|
||||
const match = (/^(#[a-f0-9]{3}|#[a-f0-9]{6}|[a-z]+)$/i).exec(res.text);
|
||||
if (!match) {
|
||||
throw new ParseError("Invalid color: '" + res.text + "'", res);
|
||||
}
|
||||
|
Reference in New Issue
Block a user