@@ -15,6 +15,7 @@ import '../model/avatar_url.dart';
15
15
import '../model/binding.dart' ;
16
16
import '../model/content.dart' ;
17
17
import '../model/internal_link.dart' ;
18
+ import '../model/settings.dart' ;
18
19
import 'code_block.dart' ;
19
20
import 'dialog.dart' ;
20
21
import 'icons.dart' ;
@@ -831,11 +832,19 @@ class MathBlock extends StatelessWidget {
831
832
@override
832
833
Widget build (BuildContext context) {
833
834
final contentTheme = ContentTheme .of (context);
834
- return _CodeBlockContainer (
835
- borderColor: contentTheme.colorMathBlockBorder,
836
- child: Text .rich (TextSpan (
837
- style: contentTheme.codeBlockTextStyles.plain,
838
- children: [TextSpan (text: node.texSource)])));
835
+ final globalSettings = GlobalStoreWidget .settingsOf (context);
836
+
837
+ final renderKatex = globalSettings.getBool (BoolGlobalSetting .renderKatex);
838
+ if (! renderKatex) {
839
+ return _CodeBlockContainer (
840
+ borderColor: contentTheme.colorMathBlockBorder,
841
+ child: Text .rich (TextSpan (
842
+ style: contentTheme.codeBlockTextStyles.plain,
843
+ children: [TextSpan (text: node.texSource)])));
844
+ }
845
+
846
+ return Text (style: contentTheme.textStyleError,
847
+ '(error: KaTeX unimplemented)' ); // TODO(#1408)
839
848
}
840
849
}
841
850
@@ -1147,11 +1156,19 @@ class _InlineContentBuilder {
1147
1156
child: MessageImageEmoji (node: node));
1148
1157
1149
1158
case MathInlineNode ():
1150
- return TextSpan (
1151
- style: widget.style
1152
- .merge (ContentTheme .of (_context! ).textStyleInlineMath)
1153
- .apply (fontSizeFactor: kInlineCodeFontSizeFactor),
1154
- children: [TextSpan (text: node.texSource)]);
1159
+ final contentTheme = ContentTheme .of (_context! );
1160
+ final globalSettings = GlobalStoreWidget .settingsOf (_context! );
1161
+ final renderKatex = globalSettings.getBool (BoolGlobalSetting .renderKatex);
1162
+ if (! renderKatex) {
1163
+ return TextSpan (
1164
+ style: widget.style
1165
+ .merge (ContentTheme .of (_context! ).textStyleInlineMath)
1166
+ .apply (fontSizeFactor: kInlineCodeFontSizeFactor),
1167
+ children: [TextSpan (text: node.texSource)]);
1168
+ }
1169
+
1170
+ return TextSpan (style: contentTheme.textStyleError,
1171
+ text: '(error: KaTeX unimplemented)' ); // TODO(#1408)
1155
1172
1156
1173
case GlobalTimeNode ():
1157
1174
return WidgetSpan (alignment: PlaceholderAlignment .middle,
0 commit comments