mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-13 06:58:40 +00:00
feat: Support \vcenter and \hbox (#2452)
* Support \vcenter, \raise, \lower, and \hbox * Update screenshots * Edit docs for strict and hbox to * Fix typo for \hbox to * Update Safari screenshot * Augment docs for \vcentcolon * Edit vcenter MathML comment. * Remove pointless class from vcenter MathML * Withdraw \raise and \lower * Updatae Chrome and Firefox screenshots * Update Safari screenshot * Delete allowedInArgument setting Co-authored-by: ylemkimon <y@ylem.kim> * Update Chrome and Firefox screenshots * Update Chrome and Firefox screenshots take 2 * Update screenshot Co-authored-by: ylemkimon <y@ylem.kim>
This commit is contained in:
@@ -327,6 +327,11 @@ const handleObject = (
|
||||
break;
|
||||
}
|
||||
|
||||
case "hbox": {
|
||||
buildA11yStrings(tree.body, a11yStrings, atomType);
|
||||
break;
|
||||
}
|
||||
|
||||
case "kern": {
|
||||
// No op: we don't attempt to present kerning information
|
||||
// to the screen reader.
|
||||
@@ -546,6 +551,11 @@ const handleObject = (
|
||||
`KaTeX-a11y: enclose node with ${tree.label} not supported yet`);
|
||||
}
|
||||
|
||||
case "vcenter": {
|
||||
buildA11yStrings(tree.body, a11yStrings, atomType);
|
||||
break;
|
||||
}
|
||||
|
||||
case "vphantom": {
|
||||
throw new Error("KaTeX-a11y: vphantom not implemented yet");
|
||||
}
|
||||
|
@@ -272,6 +272,13 @@ describe("renderA11yString", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("hbox", () => {
|
||||
test("\\hbox", () => {
|
||||
const result = renderA11yString("x+\\hbox{y}");
|
||||
expect(result).toMatchInlineSnapshot(`"x, plus, y"`);
|
||||
});
|
||||
});
|
||||
|
||||
describe("inner", () => {
|
||||
test("\\ldots", () => {
|
||||
const result = renderA11yString("\\ldots");
|
||||
@@ -524,6 +531,13 @@ describe("renderA11yString", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("vcenter", () => {
|
||||
test("\\vcenter", () => {
|
||||
const result = renderA11yString("x+\\vcenter{y}");
|
||||
expect(result).toMatchInlineSnapshot(`"x, plus, y"`);
|
||||
});
|
||||
});
|
||||
|
||||
describe("verb", () => {
|
||||
test("\\verb", () => {
|
||||
const result = renderA11yString("\\verb|hello|");
|
||||
|
Reference in New Issue
Block a user