mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 03:08:40 +00:00
* fix #2990 fix make stretchycode to textNode bug. * fix: fix stretchy.js@mathMLnode line too long * chore(screenshotter): update stretchy snapshots * fix: remove dup '\' in cdrightarrow cdleftarrow and cdlongequal * test: add stretchy MathML builder test case Co-authored-by: nferzhuang <nferzhuang@tencent.com> Co-authored-by: Ron Kok <ronkok@comcast.net>
This commit is contained in:
@@ -54,14 +54,16 @@ const stretchyCodePoint: {[string]: string} = {
|
||||
xrightleftarrows: "\u21c4",
|
||||
xrightequilibrium: "\u21cc", // Not a perfect match.
|
||||
xleftequilibrium: "\u21cb", // None better available.
|
||||
"\\\\cdrightarrow": "\u2192",
|
||||
"\\\\cdleftarrow": "\u2190",
|
||||
"\\\\cdlongequal": "=",
|
||||
"\\cdrightarrow": "\u2192",
|
||||
"\\cdleftarrow": "\u2190",
|
||||
"\\cdlongequal": "=",
|
||||
};
|
||||
|
||||
const mathMLnode = function(label: string): mathMLTree.MathNode {
|
||||
const node = new mathMLTree.MathNode(
|
||||
"mo", [new mathMLTree.TextNode(stretchyCodePoint[label])]);
|
||||
"mo",
|
||||
[new mathMLTree.TextNode(stretchyCodePoint[label.replace(/^\\/, '')])],
|
||||
);
|
||||
node.setAttribute("stretchy", "true");
|
||||
return node;
|
||||
};
|
||||
|
@@ -2245,6 +2245,15 @@ describe("A stretchy and non-shifty accent builder", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("A stretchy MathML builder", function() {
|
||||
it("should properly render stretchy accents", function() {
|
||||
const tex = `\\widetilde{ABCD}`;
|
||||
const tree = getParsed(tex);
|
||||
const markup = buildMathML(tree, tex, defaultOptions).toMarkup();
|
||||
expect(markup).toContain('<mo stretchy="true">~</mo>');
|
||||
});
|
||||
});
|
||||
|
||||
describe("An under-accent parser", function() {
|
||||
it("should not fail", function() {
|
||||
expect("\\underrightarrow{x}").toParse();
|
||||
|
Reference in New Issue
Block a user