mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-17 08:48:39 +00:00
Render MathML directly (#1966)
* Render MathML * Fix lint error * Change from main api to rendering options
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
Reference in New Issue
Block a user