@@ -1280,6 +1280,70 @@ class ContentExample {
12801280 ]),
12811281 ]);
12821282
1283+ static const mathBlockKatexNegativeMarginsOnVlistRow = ContentExample (
1284+ 'math block, KaTeX negative margins on a vlist row' ,
1285+ // https://chat.zulip.org/#narrow/channel/7-test-here/topic/Rajesh/near/2224918
1286+ '```math\n X_n\n ```' ,
1287+ '<p>'
1288+ '<span class="katex-display"><span class="katex">'
1289+ '<span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msub><mi>X</mi><mi>n</mi></msub></mrow><annotation encoding="application/x-tex">X_n</annotation></semantics></math></span>'
1290+ '<span class="katex-html" aria-hidden="true">'
1291+ '<span class="base">'
1292+ '<span class="strut" style="height:0.8333em;vertical-align:-0.15em;"></span>'
1293+ '<span class="mord">'
1294+ '<span class="mord mathnormal" style="margin-right:0.07847em;">X</span>'
1295+ '<span class="msupsub">'
1296+ '<span class="vlist-t vlist-t2">'
1297+ '<span class="vlist-r">'
1298+ '<span class="vlist" style="height:0.1514em;">'
1299+ '<span style="top:-2.55em;margin-left:-0.0785em;margin-right:0.05em;">'
1300+ '<span class="pstrut" style="height:2.7em;"></span>'
1301+ '<span class="sizing reset-size6 size3 mtight">'
1302+ '<span class="mord mathnormal mtight">n</span></span></span></span>'
1303+ '<span class="vlist-s"></span></span>'
1304+ '<span class="vlist-r">'
1305+ '<span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span></span></p>' , [
1306+ MathBlockNode (texSource: 'X_n' , nodes: [
1307+ KatexSpanNode (styles: KatexSpanStyles (), text: null , nodes: [
1308+ KatexStrutNode (heightEm: 0.8333 , verticalAlignEm: - 0.15 ),
1309+ KatexSpanNode (styles: KatexSpanStyles (), text: null , nodes: [
1310+ KatexSpanNode (
1311+ styles: KatexSpanStyles (
1312+ marginRightEm: 0.07847 ,
1313+ fontFamily: 'KaTeX_Math' , fontStyle: KatexSpanFontStyle .italic),
1314+ text: 'X' , nodes: null ),
1315+ KatexSpanNode (
1316+ styles: KatexSpanStyles (textAlign: KatexSpanTextAlign .left),
1317+ text: null , nodes: [
1318+ KatexVlistNode (rows: [
1319+ KatexVlistRowNode (
1320+ verticalOffsetEm: - 2.55 + 2.7 ,
1321+ node: KatexSpanNode (styles: KatexSpanStyles (), text: null , nodes: [
1322+ KatexNegativeMarginNode (leftOffsetEm: - 0.0785 , nodes: [
1323+ KatexSpanNode (
1324+ styles: KatexSpanStyles (
1325+ marginRightEm: 0.05 ,
1326+ // TODO parser should not emit this `marginLeftEm` here because
1327+ // it already generates `KatexNegativeMarginNode` for handling it.
1328+ marginLeftEm: - 0.0785 ),
1329+ text: null , nodes: [
1330+ KatexSpanNode (
1331+ styles: KatexSpanStyles (fontSizeEm: 0.7 ), // .reset-size6.size3
1332+ text: null , nodes: [
1333+ KatexSpanNode (
1334+ styles: KatexSpanStyles (fontFamily: 'KaTeX_Math' , fontStyle: KatexSpanFontStyle .italic),
1335+ text: 'n' , nodes: null ),
1336+ ]),
1337+ ]),
1338+ ]),
1339+ ])),
1340+ ]),
1341+ ]),
1342+ ]),
1343+ ]),
1344+ ]),
1345+ ]);
1346+
12831347 static const imageSingle = ContentExample (
12841348 'single image' ,
12851349 // https://chat.zulip.org/#narrow/stream/7-test-here/topic/Thumbnails/near/1900103
@@ -2376,6 +2440,7 @@ void main() async {
23762440 testParseExample (ContentExample .mathBlockKatexRaisebox);
23772441 testParseExample (ContentExample .mathBlockKatexNegativeMargin);
23782442 testParseExample (ContentExample .mathBlockKatexLogo);
2443+ testParseExample (ContentExample .mathBlockKatexNegativeMarginsOnVlistRow);
23792444
23802445 testParseExample (ContentExample .imageSingle);
23812446 testParseExample (ContentExample .imageSingleNoDimensions);
0 commit comments