Render MathML directly (#1966)

* Render MathML

* Fix lint error

* Change from main api to rendering options
This commit is contained in:
Ron Kok
2019-05-13 16:31:04 -07:00
committed by Kevin Barabash
parent 4f2da04e5d
commit 9822414733
6 changed files with 47 additions and 32 deletions

View File

@@ -36,12 +36,17 @@ export const buildTree = function(
settings: Settings,
): DomSpan {
const options = optionsFromSettings(settings);
const mathMLNode = buildMathML(tree, expression, options);
const htmlNode = buildHTML(tree, options);
const katexNode = buildCommon.makeSpan(["katex"], [
mathMLNode, htmlNode,
]);
let katexNode;
if (settings.output === "mathml") {
return buildMathML(tree, expression, options, true);
} else if (settings.output === "html") {
const htmlNode = buildHTML(tree, options);
katexNode = buildCommon.makeSpan(["katex"], [htmlNode]);
} else {
const mathMLNode = buildMathML(tree, expression, options, false);
const htmlNode = buildHTML(tree, options);
katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, htmlNode]);
}
return displayWrap(katexNode, settings);
};