Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var parseMath = function(text) {
// NOTE: `katex` is a global. We assume it has been imported somehow.
//
// colorIsTextColor is an option added in KaTeX 0.9.0 for backward
// compatibility. It makes \color parse like \textcolor. We use it
// in the KA webapp, and need it here because the tests are written
// assuming it is set.
return katex.__parse(text, {colorIsTextColor: true});
};
this._onValueChange = evt => {
var value = evt.target.value;
var invalid = false;
try {
katex.__parse(value);
} catch (e) {
invalid = true;
} finally {
this.setState({
invalidTeX: invalid,
texValue: value,
});
}
};
const renderA11yString = function(text: string, settings?: SettingsOptions) {
const tree = katex.__parse(text, settings);
const a11yStrings = buildA11yStrings(tree, [], "normal");
return flatten(a11yStrings).join(", ");
};
this._onValueChange = evt => {
var value = evt.target.value;
var invalid = false;
try {
katex.__parse(value);
} catch (e) {
invalid = true;
} finally {
this.setState({
invalidTeX: invalid,
texValue: value,
});
}
};