mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-07 04:08:43 +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",
|
xrightleftarrows: "\u21c4",
|
||||||
xrightequilibrium: "\u21cc", // Not a perfect match.
|
xrightequilibrium: "\u21cc", // Not a perfect match.
|
||||||
xleftequilibrium: "\u21cb", // None better available.
|
xleftequilibrium: "\u21cb", // None better available.
|
||||||
"\\\\cdrightarrow": "\u2192",
|
"\\cdrightarrow": "\u2192",
|
||||||
"\\\\cdleftarrow": "\u2190",
|
"\\cdleftarrow": "\u2190",
|
||||||
"\\\\cdlongequal": "=",
|
"\\cdlongequal": "=",
|
||||||
};
|
};
|
||||||
|
|
||||||
const mathMLnode = function(label: string): mathMLTree.MathNode {
|
const mathMLnode = function(label: string): mathMLTree.MathNode {
|
||||||
const node = new mathMLTree.MathNode(
|
const node = new mathMLTree.MathNode(
|
||||||
"mo", [new mathMLTree.TextNode(stretchyCodePoint[label])]);
|
"mo",
|
||||||
|
[new mathMLTree.TextNode(stretchyCodePoint[label.replace(/^\\/, '')])],
|
||||||
|
);
|
||||||
node.setAttribute("stretchy", "true");
|
node.setAttribute("stretchy", "true");
|
||||||
return node;
|
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() {
|
describe("An under-accent parser", function() {
|
||||||
it("should not fail", function() {
|
it("should not fail", function() {
|
||||||
expect("\\underrightarrow{x}").toParse();
|
expect("\\underrightarrow{x}").toParse();
|
||||||
|
Reference in New Issue
Block a user