mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-07 04:08:43 +00:00
21 lines
537 B
JavaScript
21 lines
537 B
JavaScript
/**
|
|
* Provides a single function for parsing an expression using a Parser
|
|
* TODO(emily): Remove this
|
|
*/
|
|
|
|
const Parser = require("./Parser");
|
|
|
|
/**
|
|
* Parses an expression using a Parser, then returns the parsed result.
|
|
*/
|
|
const parseTree = function(toParse, settings) {
|
|
if (!(typeof toParse === 'string' || toParse instanceof String)) {
|
|
throw new TypeError('KaTeX can only parse string typed expression');
|
|
}
|
|
const parser = new Parser(toParse, settings);
|
|
|
|
return parser.parse();
|
|
};
|
|
|
|
module.exports = parseTree;
|