Skip to content

Commit d060034

Browse files
content: Ensure inline styles for big operators in KaTeX content
1 parent ed9b92c commit d060034

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/model/katex.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,19 @@ class _KatexParser {
457457
_ => throw KatexHtmlParseError(),
458458
};
459459

460+
// Some .op-symbol spans can have `position: relative` with some
461+
// `top` offset as inline styles. We expect that if position is
462+
// present it is always `relative` and be accompanying with some
463+
// `top` offset.
464+
if (inlineStyles case KatexSpanStyles(
465+
:final position,
466+
:final topEm,
467+
) when position != null) {
468+
if (position != KatexSpanPosition.relative || topEm == null) {
469+
throw KatexHtmlParseError();
470+
}
471+
}
472+
460473
// TODO handle more classes from katex.scss
461474

462475
case 'mord':

0 commit comments

Comments
 (0)