@@ -492,6 +492,8 @@ class _KatexParser {
492492 if (stylesheet.topLevels case [css_visitor.RuleSet () && final rule]) {
493493 double ? heightEm;
494494 double ? verticalAlignEm;
495+ double ? marginRightEm;
496+ double ? marginLeftEm;
495497
496498 for (final declaration in rule.declarationGroup.declarations) {
497499 if (declaration case css_visitor.Declaration (
@@ -507,6 +509,20 @@ class _KatexParser {
507509 case 'vertical-align' :
508510 verticalAlignEm = _getEm (expression);
509511 if (verticalAlignEm != null ) continue ;
512+
513+ case 'margin-right' :
514+ marginRightEm = _getEm (expression);
515+ if (marginRightEm != null ) {
516+ if (marginRightEm < 0 ) throw _KatexHtmlParseError ();
517+ continue ;
518+ }
519+
520+ case 'margin-left' :
521+ marginLeftEm = _getEm (expression);
522+ if (marginLeftEm != null ) {
523+ if (marginLeftEm < 0 ) throw _KatexHtmlParseError ();
524+ continue ;
525+ }
510526 }
511527
512528 // TODO handle more CSS properties
@@ -522,6 +538,8 @@ class _KatexParser {
522538 return KatexSpanStyles (
523539 heightEm: heightEm,
524540 verticalAlignEm: verticalAlignEm,
541+ marginRightEm: marginRightEm,
542+ marginLeftEm: marginLeftEm,
525543 );
526544 } else {
527545 throw _KatexHtmlParseError ();
@@ -560,6 +578,9 @@ class KatexSpanStyles {
560578 final double ? heightEm;
561579 final double ? verticalAlignEm;
562580
581+ final double ? marginRightEm;
582+ final double ? marginLeftEm;
583+
563584 final String ? fontFamily;
564585 final double ? fontSizeEm;
565586 final KatexSpanFontWeight ? fontWeight;
@@ -569,6 +590,8 @@ class KatexSpanStyles {
569590 const KatexSpanStyles ({
570591 this .heightEm,
571592 this .verticalAlignEm,
593+ this .marginRightEm,
594+ this .marginLeftEm,
572595 this .fontFamily,
573596 this .fontSizeEm,
574597 this .fontWeight,
@@ -581,6 +604,8 @@ class KatexSpanStyles {
581604 'KatexSpanStyles' ,
582605 heightEm,
583606 verticalAlignEm,
607+ marginRightEm,
608+ marginLeftEm,
584609 fontFamily,
585610 fontSizeEm,
586611 fontWeight,
@@ -593,6 +618,8 @@ class KatexSpanStyles {
593618 return other is KatexSpanStyles &&
594619 other.heightEm == heightEm &&
595620 other.verticalAlignEm == verticalAlignEm &&
621+ other.marginRightEm == marginRightEm &&
622+ other.marginLeftEm == marginLeftEm &&
596623 other.fontFamily == fontFamily &&
597624 other.fontSizeEm == fontSizeEm &&
598625 other.fontWeight == fontWeight &&
@@ -605,6 +632,8 @@ class KatexSpanStyles {
605632 final args = < String > [];
606633 if (heightEm != null ) args.add ('heightEm: $heightEm ' );
607634 if (verticalAlignEm != null ) args.add ('verticalAlignEm: $verticalAlignEm ' );
635+ if (marginRightEm != null ) args.add ('marginRightEm: $marginRightEm ' );
636+ if (marginLeftEm != null ) args.add ('marginLeftEm: $marginLeftEm ' );
608637 if (fontFamily != null ) args.add ('fontFamily: $fontFamily ' );
609638 if (fontSizeEm != null ) args.add ('fontSizeEm: $fontSizeEm ' );
610639 if (fontWeight != null ) args.add ('fontWeight: $fontWeight ' );
@@ -624,6 +653,8 @@ class KatexSpanStyles {
624653 return KatexSpanStyles (
625654 heightEm: other.heightEm ?? heightEm,
626655 verticalAlignEm: other.verticalAlignEm ?? verticalAlignEm,
656+ marginRightEm: other.marginRightEm ?? marginRightEm,
657+ marginLeftEm: other.marginLeftEm ?? marginLeftEm,
627658 fontFamily: other.fontFamily ?? fontFamily,
628659 fontSizeEm: other.fontSizeEm ?? fontSizeEm,
629660 fontStyle: other.fontStyle ?? fontStyle,
@@ -635,6 +666,8 @@ class KatexSpanStyles {
635666 KatexSpanStyles filter ({
636667 bool heightEm = true ,
637668 bool verticalAlignEm = true ,
669+ bool marginRightEm = true ,
670+ bool marginLeftEm = true ,
638671 bool fontFamily = true ,
639672 bool fontSizeEm = true ,
640673 bool fontWeight = true ,
@@ -644,6 +677,8 @@ class KatexSpanStyles {
644677 return KatexSpanStyles (
645678 heightEm: heightEm ? this .heightEm : null ,
646679 verticalAlignEm: verticalAlignEm ? this .verticalAlignEm : null ,
680+ marginRightEm: marginRightEm ? this .marginRightEm : null ,
681+ marginLeftEm: marginLeftEm ? this .marginLeftEm : null ,
647682 fontFamily: fontFamily ? this .fontFamily : null ,
648683 fontSizeEm: fontSizeEm ? this .fontSizeEm : null ,
649684 fontWeight: fontWeight ? this .fontWeight : null ,
0 commit comments