@@ -411,6 +411,7 @@ class _KatexParser {
411411 KatexSpanFontWeight ? fontWeight;
412412 KatexSpanFontStyle ? fontStyle;
413413 KatexSpanTextAlign ? textAlign;
414+ KatexSpanBorderBottomStyle ? borderBottomStyle;
414415 var index = 0 ;
415416 while (index < spanClasses.length) {
416417 final spanClass = spanClasses[index++ ];
@@ -626,6 +627,8 @@ class _KatexParser {
626627 case 'nobreak' :
627628 case 'allowbreak' :
628629 case 'mathdefault' :
630+ case 'overline' :
631+ case 'underline' :
629632 // Ignore these classes because they don't have a CSS definition
630633 // in katex.scss, but we encounter them in the generated HTML.
631634 // (Why are they there if they're not used? The story seems to be:
@@ -636,6 +639,14 @@ class _KatexParser {
636639 // )
637640 break ;
638641
642+ case 'overline-line' :
643+ case 'underline-line' :
644+ // .underline-line { width: 100%; border-bottom-style: solid; }
645+ // Border applied via inline style: border-bottom-width: 0.04em;
646+ widthEm = double .infinity;
647+ borderBottomStyle = KatexSpanBorderBottomStyle .solid;
648+ break ;
649+
639650 default :
640651 assert (debugLog ('KaTeX: Unsupported CSS class: $spanClass ' ));
641652 unsupportedCssClasses.add (spanClass);
@@ -657,10 +668,14 @@ class _KatexParser {
657668 marginRightEm: _takeStyleEm (inlineStyles, 'margin-right' ),
658669 color: _takeStyleColor (inlineStyles, 'color' ),
659670 position: _takeStylePosition (inlineStyles, 'position' ),
671+ borderBottomStyle: borderBottomStyle,
672+ borderBottomWidthEm: _takeStyleEm (inlineStyles, 'border-bottom-width' )
660673 // TODO handle more CSS properties
661674 );
662675 if (inlineStyles != null && inlineStyles.isNotEmpty) {
663676 for (final property in inlineStyles.keys) {
677+ // Ignore known properties that don't need special handling
678+ if (property == 'width' || property == 'min-width' || property == 'border-bottom-width' ) {continue ;}
664679 assert (debugLog ('KaTeX: Unexpected inline CSS property: $property ' ));
665680 unsupportedInlineCssProperties.add (property);
666681 _hasError = true ;
@@ -840,6 +855,10 @@ enum KatexSpanPosition {
840855 relative,
841856}
842857
858+ enum KatexSpanBorderBottomStyle {
859+ solid,
860+ }
861+
843862class KatexSpanColor {
844863 const KatexSpanColor (this .r, this .g, this .b, this .a);
845864
@@ -893,6 +912,8 @@ class KatexSpanStyles {
893912
894913 final KatexSpanColor ? color;
895914 final KatexSpanPosition ? position;
915+ final KatexSpanBorderBottomStyle ? borderBottomStyle;
916+ final double ? borderBottomWidthEm;
896917
897918 const KatexSpanStyles ({
898919 this .widthEm,
@@ -907,6 +928,8 @@ class KatexSpanStyles {
907928 this .textAlign,
908929 this .color,
909930 this .position,
931+ this .borderBottomStyle,
932+ this .borderBottomWidthEm,
910933 });
911934
912935 @override
@@ -924,6 +947,8 @@ class KatexSpanStyles {
924947 textAlign,
925948 color,
926949 position,
950+ borderBottomStyle,
951+ borderBottomWidthEm
927952 );
928953
929954 @override
@@ -940,7 +965,9 @@ class KatexSpanStyles {
940965 other.fontStyle == fontStyle &&
941966 other.textAlign == textAlign &&
942967 other.color == color &&
943- other.position == position;
968+ other.position == position &&
969+ other.borderBottomStyle == borderBottomStyle &&
970+ other.borderBottomWidthEm == borderBottomWidthEm;
944971 }
945972
946973 @override
@@ -958,6 +985,8 @@ class KatexSpanStyles {
958985 if (textAlign != null ) args.add ('textAlign: $textAlign ' );
959986 if (color != null ) args.add ('color: $color ' );
960987 if (position != null ) args.add ('position: $position ' );
988+ if (borderBottomStyle != null ) args.add ('borderBottomStyle: $borderBottomStyle ' );
989+ if (borderBottomWidthEm != null ) args.add ('borderBottomWidthEm: $borderBottomWidthEm ' );
961990 return '${objectRuntimeType (this , 'KatexSpanStyles' )}(${args .join (', ' )})' ;
962991 }
963992
@@ -975,6 +1004,8 @@ class KatexSpanStyles {
9751004 bool textAlign = true ,
9761005 bool color = true ,
9771006 bool position = true ,
1007+ bool borderBottomStyle = true ,
1008+ bool borderBottomWidthEm = true ,
9781009 }) {
9791010 return KatexSpanStyles (
9801011 widthEm: widthEm ? this .widthEm : null ,
@@ -989,6 +1020,8 @@ class KatexSpanStyles {
9891020 textAlign: textAlign ? this .textAlign : null ,
9901021 color: color ? this .color : null ,
9911022 position: position ? this .position : null ,
1023+ borderBottomStyle: borderBottomStyle ? this .borderBottomStyle : null ,
1024+ borderBottomWidthEm: borderBottomWidthEm ? this .borderBottomWidthEm : null ,
9921025 );
9931026 }
9941027}
0 commit comments