@@ -392,6 +392,8 @@ class _KatexParser {
392
392
if (stylesheet.topLevels case [css_visitor.RuleSet () && final rule]) {
393
393
double ? heightEm;
394
394
double ? verticalAlignEm;
395
+ double ? marginRightEm;
396
+ double ? marginLeftEm;
395
397
396
398
for (final declaration in rule.declarationGroup.declarations) {
397
399
if (declaration case css_visitor.Declaration (
@@ -407,6 +409,20 @@ class _KatexParser {
407
409
case 'vertical-align' :
408
410
verticalAlignEm = _getEm (expression);
409
411
if (verticalAlignEm != null ) continue ;
412
+
413
+ case 'margin-right' :
414
+ marginRightEm = _getEm (expression);
415
+ if (marginRightEm != null ) {
416
+ if (marginRightEm < 0 ) throw KatexHtmlParseError ();
417
+ continue ;
418
+ }
419
+
420
+ case 'margin-left' :
421
+ marginLeftEm = _getEm (expression);
422
+ if (marginLeftEm != null ) {
423
+ if (marginLeftEm < 0 ) throw KatexHtmlParseError ();
424
+ continue ;
425
+ }
410
426
}
411
427
412
428
// TODO handle more CSS properties
@@ -421,6 +437,8 @@ class _KatexParser {
421
437
return KatexSpanStyles (
422
438
heightEm: heightEm,
423
439
verticalAlignEm: verticalAlignEm,
440
+ marginRightEm: marginRightEm,
441
+ marginLeftEm: marginLeftEm,
424
442
);
425
443
} else {
426
444
throw KatexHtmlParseError ();
@@ -459,6 +477,9 @@ class KatexSpanStyles {
459
477
final double ? heightEm;
460
478
final double ? verticalAlignEm;
461
479
480
+ final double ? marginRightEm;
481
+ final double ? marginLeftEm;
482
+
462
483
final String ? fontFamily;
463
484
final double ? fontSizeEm;
464
485
final KatexSpanFontWeight ? fontWeight;
@@ -468,6 +489,8 @@ class KatexSpanStyles {
468
489
const KatexSpanStyles ({
469
490
this .heightEm,
470
491
this .verticalAlignEm,
492
+ this .marginRightEm,
493
+ this .marginLeftEm,
471
494
this .fontFamily,
472
495
this .fontSizeEm,
473
496
this .fontWeight,
@@ -480,6 +503,8 @@ class KatexSpanStyles {
480
503
'KatexSpanStyles' ,
481
504
heightEm,
482
505
verticalAlignEm,
506
+ marginRightEm,
507
+ marginLeftEm,
483
508
fontFamily,
484
509
fontSizeEm,
485
510
fontWeight,
@@ -492,6 +517,8 @@ class KatexSpanStyles {
492
517
return other is KatexSpanStyles &&
493
518
other.heightEm == heightEm &&
494
519
other.verticalAlignEm == verticalAlignEm &&
520
+ other.marginRightEm == marginRightEm &&
521
+ other.marginLeftEm == marginLeftEm &&
495
522
other.fontFamily == fontFamily &&
496
523
other.fontSizeEm == fontSizeEm &&
497
524
other.fontWeight == fontWeight &&
@@ -504,6 +531,8 @@ class KatexSpanStyles {
504
531
final args = < String > [];
505
532
if (heightEm != null ) args.add ('heightEm: $heightEm ' );
506
533
if (verticalAlignEm != null ) args.add ('verticalAlignEm: $verticalAlignEm ' );
534
+ if (marginRightEm != null ) args.add ('marginRightEm: $marginRightEm ' );
535
+ if (marginLeftEm != null ) args.add ('marginLeftEm: $marginLeftEm ' );
507
536
if (fontFamily != null ) args.add ('fontFamily: $fontFamily ' );
508
537
if (fontSizeEm != null ) args.add ('fontSizeEm: $fontSizeEm ' );
509
538
if (fontWeight != null ) args.add ('fontWeight: $fontWeight ' );
@@ -516,6 +545,8 @@ class KatexSpanStyles {
516
545
return KatexSpanStyles (
517
546
heightEm: other.heightEm ?? heightEm,
518
547
verticalAlignEm: other.verticalAlignEm ?? verticalAlignEm,
548
+ marginRightEm: other.marginRightEm ?? marginRightEm,
549
+ marginLeftEm: other.marginLeftEm ?? marginLeftEm,
519
550
fontFamily: other.fontFamily ?? fontFamily,
520
551
fontSizeEm: other.fontSizeEm ?? fontSizeEm,
521
552
fontStyle: other.fontStyle ?? fontStyle,
0 commit comments