mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-13 06:58:40 +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:
@@ -973,11 +973,16 @@ export default class Parser {
|
||||
}
|
||||
symbol = new ParseNode(symbols[this.mode][text].group,
|
||||
text, this.mode, nucleus);
|
||||
} else if (supportedCodepoint(text.charCodeAt(0))) {
|
||||
if (this.settings.strict && this.mode === 'math') {
|
||||
this.settings.reportNonstrict("unicodeTextInMathMode",
|
||||
`Unicode text character "${text[0]}" used in math mode`,
|
||||
nucleus);
|
||||
} else if (text.charCodeAt(0) >= 0x80) { // no symbol for e.g. ^
|
||||
if (this.settings.strict) {
|
||||
if (!supportedCodepoint(text.charCodeAt(0))) {
|
||||
this.settings.reportNonstrict("unknownSymbol",
|
||||
`Unrecognized Unicode character "${text[0]}"`, nucleus);
|
||||
} else if (this.mode === "math") {
|
||||
this.settings.reportNonstrict("unicodeTextInMathMode",
|
||||
`Unicode text character "${text[0]}" used in math mode`,
|
||||
nucleus);
|
||||
}
|
||||
}
|
||||
symbol = new ParseNode("textord", text, this.mode, nucleus);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user