mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-07 04:08:43 +00:00
Allow all Unicode symbols in nonstrict mode (#1217)
Change symbol parsing to allow all Unicode symbols when the appropriate strict setting allows it. By default, this allows all symbols, but the user will get (probably two) warnings about them.
This commit is contained in:
@@ -137,6 +137,27 @@ describe("unicode", function() {
|
||||
expect('ěščřžůřťďňőİı').toNotParse(strictSettings);
|
||||
});
|
||||
|
||||
it("should not allow emoji in strict mode", function() {
|
||||
expect('✌').toNotParse(strictSettings);
|
||||
expect('\\text{✌}').toNotParse(strictSettings);
|
||||
const settings = new Settings({
|
||||
strict: (errorCode) =>
|
||||
(errorCode === "unknownSymbol" ? "error" : "ignore"),
|
||||
});
|
||||
expect('✌').toNotParse(settings);
|
||||
expect('\\text{✌}').toNotParse(settings);
|
||||
});
|
||||
|
||||
it("should allow emoji outside strict mode", function() {
|
||||
expect('✌').toWarn();
|
||||
expect('\\text{✌}').toWarn();
|
||||
const settings = new Settings({
|
||||
strict: (errorCode) =>
|
||||
(errorCode === "unknownSymbol" ? "ignore" : "error"),
|
||||
});
|
||||
expect('✌').toParse(settings);
|
||||
expect('\\text{✌}').toParse(settings);
|
||||
});
|
||||
});
|
||||
|
||||
describe("unicodeScripts", () => {
|
||||
|
Reference in New Issue
Block a user