How to use the katex.__parse function in katex

To help you get started, we’ve selected a few katex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Khan / react-components / js / katex-a11y.js View on Github external
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});
};
github facebook / draft-js / examples / draft-0-9-1 / tex / js / components / TeXBlock.js View on Github external
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,
        });
      }
    };
github KaTeX / KaTeX / contrib / render-a11y-string / render-a11y-string.js View on Github external
const renderA11yString = function(text: string, settings?: SettingsOptions) {

    const tree = katex.__parse(text, settings);
    const a11yStrings = buildA11yStrings(tree, [], "normal");
    return flatten(a11yStrings).join(", ");
};
github facebook / draft-js / examples / draft-0-10-0 / tex / js / components / TeXBlock.js View on Github external
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,
        });
      }
    };