MCPcopy Index your code
hub / github.com/TruthHun/BookStack / parseTree_parseTree

Function parseTree_parseTree

static/katex/katex.js:16279–16305  ·  view source on GitHub ↗
(toParse, settings)

Source from the content-addressed store, hash-verified

16277 * Parses an expression using a Parser, then returns the parsed result.
16278 */
16279var parseTree_parseTree = function parseTree(toParse, settings) {
16280 if (!(typeof toParse === 'string' || toParse instanceof String)) {
16281 throw new TypeError('KaTeX can only parse string typed expression');
16282 }
16283
16284 var parser = new Parser_Parser(toParse, settings); // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors
16285
16286 delete parser.gullet.macros.current["\\df@tag"];
16287 var tree = parser.parse(); // If the input used \tag, it will set the \df@tag macro to the tag.
16288 // In this case, we separately parse the tag and wrap the tree.
16289
16290 if (parser.gullet.macros.get("\\df@tag")) {
16291 if (!settings.displayMode) {
16292 throw new src_ParseError("\\tag works only in display equations");
16293 }
16294
16295 parser.gullet.feed("\\df@tag");
16296 tree = [{
16297 type: "tag",
16298 mode: "text",
16299 body: tree,
16300 tag: parser.parse()
16301 }];
16302 }
16303
16304 return tree;
16305};
16306
16307/* harmony default export */ var src_parseTree = (parseTree_parseTree);
16308// CONCATENATED MODULE: ./katex.js

Callers

nothing calls this directly

Calls 3

parseMethod · 0.80
feedMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected