Showing
4 changed files
with
49 additions
and
7 deletions
@@ -161,13 +161,15 @@ Markdown and LaTeX can be powerful tools for formatting text and mathematical ex | @@ -161,13 +161,15 @@ Markdown and LaTeX can be powerful tools for formatting text and mathematical ex | ||
161 | log(url, name: "url"); | 161 | log(url, name: "url"); |
162 | }, | 162 | }, |
163 | textAlign: TextAlign.justify, | 163 | textAlign: TextAlign.justify, |
164 | - textScaler: const TextScaler.linear(1.3), | ||
165 | - // textScaler: | ||
166 | - // MediaQuery.textScalerOf(context), | 164 | + // textScaler: const TextScaler.linear(1.3), |
165 | + textScaler: MediaQuery.textScalerOf(context), | ||
167 | style: const TextStyle( | 166 | style: const TextStyle( |
168 | // Regular text font size here. | 167 | // Regular text font size here. |
169 | fontSize: 15, | 168 | fontSize: 15, |
170 | ), | 169 | ), |
170 | + latexWorkaround: (tex) => | ||
171 | + tex.replaceAllMapped(RegExp(r"align\*"), | ||
172 | + (match) => "aligned"), | ||
171 | ), | 173 | ), |
172 | // child: const Text("Hello"), | 174 | // child: const Text("Hello"), |
173 | ); | 175 | ); |
@@ -12,6 +12,7 @@ class TexMarkdown extends StatelessWidget { | @@ -12,6 +12,7 @@ class TexMarkdown extends StatelessWidget { | ||
12 | this.style, | 12 | this.style, |
13 | this.followLinkColor = false, | 13 | this.followLinkColor = false, |
14 | this.textDirection = TextDirection.ltr, | 14 | this.textDirection = TextDirection.ltr, |
15 | + this.latexWorkaround, | ||
15 | this.textAlign, | 16 | this.textAlign, |
16 | this.textScaler, | 17 | this.textScaler, |
17 | this.onLinkTab, | 18 | this.onLinkTab, |
@@ -22,6 +23,7 @@ class TexMarkdown extends StatelessWidget { | @@ -22,6 +23,7 @@ class TexMarkdown extends StatelessWidget { | ||
22 | final TextAlign? textAlign; | 23 | final TextAlign? textAlign; |
23 | final TextScaler? textScaler; | 24 | final TextScaler? textScaler; |
24 | final void Function(String url, String title)? onLinkTab; | 25 | final void Function(String url, String title)? onLinkTab; |
26 | + final String Function(String tex)? latexWorkaround; | ||
25 | final bool followLinkColor; | 27 | final bool followLinkColor; |
26 | 28 | ||
27 | @override | 29 | @override |
@@ -35,6 +37,7 @@ class TexMarkdown extends StatelessWidget { | @@ -35,6 +37,7 @@ class TexMarkdown extends StatelessWidget { | ||
35 | textAlign: textAlign, | 37 | textAlign: textAlign, |
36 | textScaler: textScaler, | 38 | textScaler: textScaler, |
37 | followLinkColor: followLinkColor, | 39 | followLinkColor: followLinkColor, |
40 | + latexWorkaround: latexWorkaround, | ||
38 | )); | 41 | )); |
39 | } | 42 | } |
40 | } | 43 | } |
@@ -31,6 +31,7 @@ abstract class MarkdownComponent { | @@ -31,6 +31,7 @@ abstract class MarkdownComponent { | ||
31 | TextStyle? style, | 31 | TextStyle? style, |
32 | TextDirection textDirection, | 32 | TextDirection textDirection, |
33 | final void Function(String url, String title)? onLinkTab, | 33 | final void Function(String url, String title)? onLinkTab, |
34 | + final String Function(String tex)? latexWorkaround, | ||
34 | ) { | 35 | ) { |
35 | List<InlineSpan> spans = []; | 36 | List<InlineSpan> spans = []; |
36 | List<String> regexes = | 37 | List<String> regexes = |
@@ -55,6 +56,7 @@ abstract class MarkdownComponent { | @@ -55,6 +56,7 @@ abstract class MarkdownComponent { | ||
55 | style, | 56 | style, |
56 | textDirection, | 57 | textDirection, |
57 | onLinkTab, | 58 | onLinkTab, |
59 | + latexWorkaround, | ||
58 | )); | 60 | )); |
59 | } else { | 61 | } else { |
60 | if (each is BlockMd) { | 62 | if (each is BlockMd) { |
@@ -73,6 +75,7 @@ abstract class MarkdownComponent { | @@ -73,6 +75,7 @@ abstract class MarkdownComponent { | ||
73 | style, | 75 | style, |
74 | textDirection, | 76 | textDirection, |
75 | onLinkTab, | 77 | onLinkTab, |
78 | + latexWorkaround, | ||
76 | ), | 79 | ), |
77 | TextSpan( | 80 | TextSpan( |
78 | text: "\n ", | 81 | text: "\n ", |
@@ -110,6 +113,7 @@ abstract class MarkdownComponent { | @@ -110,6 +113,7 @@ abstract class MarkdownComponent { | ||
110 | TextStyle? style, | 113 | TextStyle? style, |
111 | TextDirection textDirection, | 114 | TextDirection textDirection, |
112 | final void Function(String url, String title)? onLinkTab, | 115 | final void Function(String url, String title)? onLinkTab, |
116 | + final String Function(String tex)? latexWorkaround, | ||
113 | ); | 117 | ); |
114 | 118 | ||
115 | RegExp get exp; | 119 | RegExp get exp; |
@@ -128,6 +132,7 @@ abstract class InlineMd extends MarkdownComponent { | @@ -128,6 +132,7 @@ abstract class InlineMd extends MarkdownComponent { | ||
128 | TextStyle? style, | 132 | TextStyle? style, |
129 | TextDirection textDirection, | 133 | TextDirection textDirection, |
130 | final void Function(String url, String title)? onLinkTab, | 134 | final void Function(String url, String title)? onLinkTab, |
135 | + final String Function(String tex)? latexWorkaround, | ||
131 | ); | 136 | ); |
132 | } | 137 | } |
133 | 138 | ||
@@ -142,6 +147,7 @@ abstract class BlockMd extends MarkdownComponent { | @@ -142,6 +147,7 @@ abstract class BlockMd extends MarkdownComponent { | ||
142 | TextStyle? style, | 147 | TextStyle? style, |
143 | TextDirection textDirection, | 148 | TextDirection textDirection, |
144 | final void Function(String url, String title)? onLinkTab, | 149 | final void Function(String url, String title)? onLinkTab, |
150 | + final String Function(String tex)? latexWorkaround, | ||
145 | ) { | 151 | ) { |
146 | return WidgetSpan( | 152 | return WidgetSpan( |
147 | child: build( | 153 | child: build( |
@@ -150,6 +156,7 @@ abstract class BlockMd extends MarkdownComponent { | @@ -150,6 +156,7 @@ abstract class BlockMd extends MarkdownComponent { | ||
150 | style, | 156 | style, |
151 | textDirection, | 157 | textDirection, |
152 | onLinkTab, | 158 | onLinkTab, |
159 | + latexWorkaround, | ||
153 | ), | 160 | ), |
154 | alignment: PlaceholderAlignment.middle, | 161 | alignment: PlaceholderAlignment.middle, |
155 | ); | 162 | ); |
@@ -161,6 +168,7 @@ abstract class BlockMd extends MarkdownComponent { | @@ -161,6 +168,7 @@ abstract class BlockMd extends MarkdownComponent { | ||
161 | TextStyle? style, | 168 | TextStyle? style, |
162 | TextDirection textDirection, | 169 | TextDirection textDirection, |
163 | final void Function(String url, String title)? onLinkTab, | 170 | final void Function(String url, String title)? onLinkTab, |
171 | + final String Function(String tex)? latexWorkaround, | ||
164 | ); | 172 | ); |
165 | } | 173 | } |
166 | 174 | ||
@@ -175,6 +183,7 @@ class HTag extends BlockMd { | @@ -175,6 +183,7 @@ class HTag extends BlockMd { | ||
175 | TextStyle? style, | 183 | TextStyle? style, |
176 | TextDirection textDirection, | 184 | TextDirection textDirection, |
177 | final void Function(String url, String title)? onLinkTab, | 185 | final void Function(String url, String title)? onLinkTab, |
186 | + final String Function(String tex)? latexWorkaround, | ||
178 | ) { | 187 | ) { |
179 | var match = exp.firstMatch(text.trim()); | 188 | var match = exp.firstMatch(text.trim()); |
180 | return Text.rich( | 189 | return Text.rich( |
@@ -211,6 +220,7 @@ class HTag extends BlockMd { | @@ -211,6 +220,7 @@ class HTag extends BlockMd { | ||
211 | ][match![1]!.length - 1], | 220 | ][match![1]!.length - 1], |
212 | textDirection, | 221 | textDirection, |
213 | (url, title) {}, | 222 | (url, title) {}, |
223 | + latexWorkaround, | ||
214 | )), | 224 | )), |
215 | if (match[1]!.length == 1) ...[ | 225 | if (match[1]!.length == 1) ...[ |
216 | const TextSpan( | 226 | const TextSpan( |
@@ -248,6 +258,7 @@ class HrLine extends BlockMd { | @@ -248,6 +258,7 @@ class HrLine extends BlockMd { | ||
248 | TextStyle? style, | 258 | TextStyle? style, |
249 | TextDirection textDirection, | 259 | TextDirection textDirection, |
250 | final void Function(String url, String title)? onLinkTab, | 260 | final void Function(String url, String title)? onLinkTab, |
261 | + final String Function(String tex)? latexWorkaround, | ||
251 | ) { | 262 | ) { |
252 | return CustomDivider( | 263 | return CustomDivider( |
253 | height: 2, | 264 | height: 2, |
@@ -269,6 +280,7 @@ class CheckBoxMd extends BlockMd { | @@ -269,6 +280,7 @@ class CheckBoxMd extends BlockMd { | ||
269 | TextStyle? style, | 280 | TextStyle? style, |
270 | TextDirection textDirection, | 281 | TextDirection textDirection, |
271 | final void Function(String url, String title)? onLinkTab, | 282 | final void Function(String url, String title)? onLinkTab, |
283 | + final String Function(String tex)? latexWorkaround, | ||
272 | ) { | 284 | ) { |
273 | var match = exp.firstMatch(text.trim()); | 285 | var match = exp.firstMatch(text.trim()); |
274 | return CustomCb( | 286 | return CustomCb( |
@@ -279,6 +291,7 @@ class CheckBoxMd extends BlockMd { | @@ -279,6 +291,7 @@ class CheckBoxMd extends BlockMd { | ||
279 | onLinkTab: onLinkTab, | 291 | onLinkTab: onLinkTab, |
280 | textDirection: textDirection, | 292 | textDirection: textDirection, |
281 | style: style, | 293 | style: style, |
294 | + latexWorkaround: latexWorkaround, | ||
282 | ), | 295 | ), |
283 | ); | 296 | ); |
284 | } | 297 | } |
@@ -297,6 +310,7 @@ class RadioButtonMd extends BlockMd { | @@ -297,6 +310,7 @@ class RadioButtonMd extends BlockMd { | ||
297 | TextStyle? style, | 310 | TextStyle? style, |
298 | TextDirection textDirection, | 311 | TextDirection textDirection, |
299 | final void Function(String url, String title)? onLinkTab, | 312 | final void Function(String url, String title)? onLinkTab, |
313 | + final String Function(String tex)? latexWorkaround, | ||
300 | ) { | 314 | ) { |
301 | var match = exp.firstMatch(text.trim()); | 315 | var match = exp.firstMatch(text.trim()); |
302 | return CustomRb( | 316 | return CustomRb( |
@@ -307,6 +321,7 @@ class RadioButtonMd extends BlockMd { | @@ -307,6 +321,7 @@ class RadioButtonMd extends BlockMd { | ||
307 | onLinkTab: onLinkTab, | 321 | onLinkTab: onLinkTab, |
308 | textDirection: textDirection, | 322 | textDirection: textDirection, |
309 | style: style, | 323 | style: style, |
324 | + latexWorkaround: latexWorkaround, | ||
310 | ), | 325 | ), |
311 | ); | 326 | ); |
312 | } | 327 | } |
@@ -325,6 +340,7 @@ class IndentMd extends BlockMd { | @@ -325,6 +340,7 @@ class IndentMd extends BlockMd { | ||
325 | TextStyle? style, | 340 | TextStyle? style, |
326 | TextDirection textDirection, | 341 | TextDirection textDirection, |
327 | final void Function(String url, String title)? onLinkTab, | 342 | final void Function(String url, String title)? onLinkTab, |
343 | + final String Function(String tex)? latexWorkaround, | ||
328 | ) { | 344 | ) { |
329 | [ | 345 | [ |
330 | r"\\\[(.*?)\\\]", | 346 | r"\\\[(.*?)\\\]", |
@@ -346,6 +362,7 @@ class IndentMd extends BlockMd { | @@ -346,6 +362,7 @@ class IndentMd extends BlockMd { | ||
346 | style, | 362 | style, |
347 | textDirection, | 363 | textDirection, |
348 | onLinkTab, | 364 | onLinkTab, |
365 | + latexWorkaround, | ||
349 | ), | 366 | ), |
350 | )), | 367 | )), |
351 | ); | 368 | ); |
@@ -365,6 +382,7 @@ class UnOrderedList extends BlockMd { | @@ -365,6 +382,7 @@ class UnOrderedList extends BlockMd { | ||
365 | TextStyle? style, | 382 | TextStyle? style, |
366 | TextDirection textDirection, | 383 | TextDirection textDirection, |
367 | final void Function(String url, String title)? onLinkTab, | 384 | final void Function(String url, String title)? onLinkTab, |
385 | + final String Function(String tex)? latexWorkaround, | ||
368 | ) { | 386 | ) { |
369 | var match = exp.firstMatch(text); | 387 | var match = exp.firstMatch(text); |
370 | return UnorderedListView( | 388 | return UnorderedListView( |
@@ -377,6 +395,7 @@ class UnOrderedList extends BlockMd { | @@ -377,6 +395,7 @@ class UnOrderedList extends BlockMd { | ||
377 | onLinkTab: onLinkTab, | 395 | onLinkTab: onLinkTab, |
378 | textDirection: textDirection, | 396 | textDirection: textDirection, |
379 | style: style, | 397 | style: style, |
398 | + latexWorkaround: latexWorkaround, | ||
380 | ), | 399 | ), |
381 | ); | 400 | ); |
382 | } | 401 | } |
@@ -396,6 +415,7 @@ class OrderedList extends BlockMd { | @@ -396,6 +415,7 @@ class OrderedList extends BlockMd { | ||
396 | TextStyle? style, | 415 | TextStyle? style, |
397 | TextDirection textDirection, | 416 | TextDirection textDirection, |
398 | final void Function(String url, String title)? onLinkTab, | 417 | final void Function(String url, String title)? onLinkTab, |
418 | + final String Function(String tex)? latexWorkaround, | ||
399 | ) { | 419 | ) { |
400 | var match = exp.firstMatch(text.trim()); | 420 | var match = exp.firstMatch(text.trim()); |
401 | return OrderedListView( | 421 | return OrderedListView( |
@@ -407,6 +427,7 @@ class OrderedList extends BlockMd { | @@ -407,6 +427,7 @@ class OrderedList extends BlockMd { | ||
407 | onLinkTab: onLinkTab, | 427 | onLinkTab: onLinkTab, |
408 | textDirection: textDirection, | 428 | textDirection: textDirection, |
409 | style: style, | 429 | style: style, |
430 | + latexWorkaround: latexWorkaround, | ||
410 | ), | 431 | ), |
411 | ); | 432 | ); |
412 | } | 433 | } |
@@ -424,6 +445,7 @@ class BoldMd extends InlineMd { | @@ -424,6 +445,7 @@ class BoldMd extends InlineMd { | ||
424 | TextStyle? style, | 445 | TextStyle? style, |
425 | TextDirection textDirection, | 446 | TextDirection textDirection, |
426 | final void Function(String url, String title)? onLinkTab, | 447 | final void Function(String url, String title)? onLinkTab, |
448 | + final String Function(String tex)? latexWorkaround, | ||
427 | ) { | 449 | ) { |
428 | var match = exp.firstMatch(text.trim()); | 450 | var match = exp.firstMatch(text.trim()); |
429 | return TextSpan( | 451 | return TextSpan( |
@@ -434,6 +456,7 @@ class BoldMd extends InlineMd { | @@ -434,6 +456,7 @@ class BoldMd extends InlineMd { | ||
434 | const TextStyle(fontWeight: FontWeight.w900), | 456 | const TextStyle(fontWeight: FontWeight.w900), |
435 | textDirection, | 457 | textDirection, |
436 | onLinkTab, | 458 | onLinkTab, |
459 | + latexWorkaround, | ||
437 | ), | 460 | ), |
438 | style: style?.copyWith(fontWeight: FontWeight.bold) ?? | 461 | style: style?.copyWith(fontWeight: FontWeight.bold) ?? |
439 | const TextStyle(fontWeight: FontWeight.bold), | 462 | const TextStyle(fontWeight: FontWeight.bold), |
@@ -455,15 +478,17 @@ class LatexMathMultyLine extends InlineMd { | @@ -455,15 +478,17 @@ class LatexMathMultyLine extends InlineMd { | ||
455 | TextStyle? style, | 478 | TextStyle? style, |
456 | TextDirection textDirection, | 479 | TextDirection textDirection, |
457 | final void Function(String url, String title)? onLinkTab, | 480 | final void Function(String url, String title)? onLinkTab, |
481 | + final String Function(String tex)? latexWorkaround, | ||
458 | ) { | 482 | ) { |
459 | var p0 = exp.firstMatch(text.trim()); | 483 | var p0 = exp.firstMatch(text.trim()); |
460 | p0?.group(0); | 484 | p0?.group(0); |
461 | String mathText = p0?[1]?.toString() ?? ""; | 485 | String mathText = p0?[1]?.toString() ?? ""; |
486 | + var workaround = latexWorkaround ?? (String tex) => tex; | ||
462 | return WidgetSpan( | 487 | return WidgetSpan( |
463 | alignment: PlaceholderAlignment.baseline, | 488 | alignment: PlaceholderAlignment.baseline, |
464 | baseline: TextBaseline.alphabetic, | 489 | baseline: TextBaseline.alphabetic, |
465 | child: Math.tex( | 490 | child: Math.tex( |
466 | - mathText, | 491 | + workaround(mathText), |
467 | textStyle: style?.copyWith( | 492 | textStyle: style?.copyWith( |
468 | fontFamily: "SansSerif", | 493 | fontFamily: "SansSerif", |
469 | ), | 494 | ), |
@@ -491,7 +516,7 @@ class LatexMathMultyLine extends InlineMd { | @@ -491,7 +516,7 @@ class LatexMathMultyLine extends InlineMd { | ||
491 | ), | 516 | ), |
492 | onErrorFallback: (err) { | 517 | onErrorFallback: (err) { |
493 | return Text( | 518 | return Text( |
494 | - mathText, | 519 | + workaround(mathText), |
495 | textDirection: textDirection, | 520 | textDirection: textDirection, |
496 | style: | 521 | style: |
497 | style?.copyWith(color: Theme.of(context).colorScheme.error) ?? | 522 | style?.copyWith(color: Theme.of(context).colorScheme.error) ?? |
@@ -521,15 +546,17 @@ class LatexMath extends InlineMd { | @@ -521,15 +546,17 @@ class LatexMath extends InlineMd { | ||
521 | TextStyle? style, | 546 | TextStyle? style, |
522 | TextDirection textDirection, | 547 | TextDirection textDirection, |
523 | final void Function(String url, String title)? onLinkTab, | 548 | final void Function(String url, String title)? onLinkTab, |
549 | + final String Function(String tex)? latexWorkaround, | ||
524 | ) { | 550 | ) { |
525 | var p0 = exp.firstMatch(text.trim()); | 551 | var p0 = exp.firstMatch(text.trim()); |
526 | p0?.group(0); | 552 | p0?.group(0); |
527 | String mathText = p0?[1]?.toString() ?? ""; | 553 | String mathText = p0?[1]?.toString() ?? ""; |
554 | + var workaround = latexWorkaround ?? (String tex) => tex; | ||
528 | return WidgetSpan( | 555 | return WidgetSpan( |
529 | alignment: PlaceholderAlignment.baseline, | 556 | alignment: PlaceholderAlignment.baseline, |
530 | baseline: TextBaseline.alphabetic, | 557 | baseline: TextBaseline.alphabetic, |
531 | child: Math.tex( | 558 | child: Math.tex( |
532 | - mathText, | 559 | + workaround(mathText), |
533 | textStyle: style?.copyWith( | 560 | textStyle: style?.copyWith( |
534 | fontFamily: "SansSerif", | 561 | fontFamily: "SansSerif", |
535 | ), | 562 | ), |
@@ -557,7 +584,7 @@ class LatexMath extends InlineMd { | @@ -557,7 +584,7 @@ class LatexMath extends InlineMd { | ||
557 | ), | 584 | ), |
558 | onErrorFallback: (err) { | 585 | onErrorFallback: (err) { |
559 | return Text( | 586 | return Text( |
560 | - mathText, | 587 | + workaround(mathText), |
561 | textDirection: textDirection, | 588 | textDirection: textDirection, |
562 | style: | 589 | style: |
563 | style?.copyWith(color: Theme.of(context).colorScheme.error) ?? | 590 | style?.copyWith(color: Theme.of(context).colorScheme.error) ?? |
@@ -581,6 +608,7 @@ class ItalicMd extends InlineMd { | @@ -581,6 +608,7 @@ class ItalicMd extends InlineMd { | ||
581 | TextStyle? style, | 608 | TextStyle? style, |
582 | TextDirection textDirection, | 609 | TextDirection textDirection, |
583 | final void Function(String url, String title)? onLinkTab, | 610 | final void Function(String url, String title)? onLinkTab, |
611 | + final String Function(String tex)? latexWorkaround, | ||
584 | ) { | 612 | ) { |
585 | var match = exp.firstMatch(text.trim()); | 613 | var match = exp.firstMatch(text.trim()); |
586 | return TextSpan( | 614 | return TextSpan( |
@@ -590,6 +618,7 @@ class ItalicMd extends InlineMd { | @@ -590,6 +618,7 @@ class ItalicMd extends InlineMd { | ||
590 | (style ?? const TextStyle()).copyWith(fontStyle: FontStyle.italic), | 618 | (style ?? const TextStyle()).copyWith(fontStyle: FontStyle.italic), |
591 | textDirection, | 619 | textDirection, |
592 | onLinkTab, | 620 | onLinkTab, |
621 | + latexWorkaround, | ||
593 | ), | 622 | ), |
594 | style: (style ?? const TextStyle()).copyWith(fontStyle: FontStyle.italic), | 623 | style: (style ?? const TextStyle()).copyWith(fontStyle: FontStyle.italic), |
595 | ); | 624 | ); |
@@ -608,6 +637,7 @@ class ATagMd extends InlineMd { | @@ -608,6 +637,7 @@ class ATagMd extends InlineMd { | ||
608 | TextStyle? style, | 637 | TextStyle? style, |
609 | TextDirection textDirection, | 638 | TextDirection textDirection, |
610 | final void Function(String url, String title)? onLinkTab, | 639 | final void Function(String url, String title)? onLinkTab, |
640 | + final String Function(String tex)? latexWorkaround, | ||
611 | ) { | 641 | ) { |
612 | var match = exp.firstMatch(text.trim()); | 642 | var match = exp.firstMatch(text.trim()); |
613 | if (match?[1] == null && match?[2] == null) { | 643 | if (match?[1] == null && match?[2] == null) { |
@@ -651,6 +681,7 @@ class ImageMd extends InlineMd { | @@ -651,6 +681,7 @@ class ImageMd extends InlineMd { | ||
651 | TextStyle? style, | 681 | TextStyle? style, |
652 | TextDirection textDirection, | 682 | TextDirection textDirection, |
653 | final void Function(String url, String title)? onLinkTab, | 683 | final void Function(String url, String title)? onLinkTab, |
684 | + final String Function(String tex)? latexWorkaround, | ||
654 | ) { | 685 | ) { |
655 | var match = exp.firstMatch(text.trim()); | 686 | var match = exp.firstMatch(text.trim()); |
656 | double? height; | 687 | double? height; |
@@ -701,6 +732,7 @@ class TableMd extends BlockMd { | @@ -701,6 +732,7 @@ class TableMd extends BlockMd { | ||
701 | TextStyle? style, | 732 | TextStyle? style, |
702 | TextDirection textDirection, | 733 | TextDirection textDirection, |
703 | void Function(String url, String title)? onLinkTab, | 734 | void Function(String url, String title)? onLinkTab, |
735 | + final String Function(String tex)? latexWorkaround, | ||
704 | ) { | 736 | ) { |
705 | final List<Map<int, String>> value = text | 737 | final List<Map<int, String>> value = text |
706 | .split('\n') | 738 | .split('\n') |
@@ -739,6 +771,7 @@ class TableMd extends BlockMd { | @@ -739,6 +771,7 @@ class TableMd extends BlockMd { | ||
739 | textDirection: textDirection, | 771 | textDirection: textDirection, |
740 | onLinkTab: onLinkTab, | 772 | onLinkTab: onLinkTab, |
741 | style: style, | 773 | style: style, |
774 | + latexWorkaround: latexWorkaround, | ||
742 | ), | 775 | ), |
743 | ), | 776 | ), |
744 | ), | 777 | ), |
@@ -12,6 +12,7 @@ class MdWidget extends StatelessWidget { | @@ -12,6 +12,7 @@ class MdWidget extends StatelessWidget { | ||
12 | this.onLinkTab, | 12 | this.onLinkTab, |
13 | this.textAlign, | 13 | this.textAlign, |
14 | this.textScaler, | 14 | this.textScaler, |
15 | + this.latexWorkaround, | ||
15 | this.followLinkColor = false}); | 16 | this.followLinkColor = false}); |
16 | final String exp; | 17 | final String exp; |
17 | final TextDirection textDirection; | 18 | final TextDirection textDirection; |
@@ -19,6 +20,7 @@ class MdWidget extends StatelessWidget { | @@ -19,6 +20,7 @@ class MdWidget extends StatelessWidget { | ||
19 | final TextAlign? textAlign; | 20 | final TextAlign? textAlign; |
20 | final TextScaler? textScaler; | 21 | final TextScaler? textScaler; |
21 | final void Function(String url, String title)? onLinkTab; | 22 | final void Function(String url, String title)? onLinkTab; |
23 | + final String Function(String tex)? latexWorkaround; | ||
22 | final bool followLinkColor; | 24 | final bool followLinkColor; |
23 | 25 | ||
24 | @override | 26 | @override |
@@ -86,6 +88,7 @@ class MdWidget extends StatelessWidget { | @@ -86,6 +88,7 @@ class MdWidget extends StatelessWidget { | ||
86 | textDirection: textDirection, | 88 | textDirection: textDirection, |
87 | onLinkTab: onLinkTab, | 89 | onLinkTab: onLinkTab, |
88 | style: style, | 90 | style: style, |
91 | + latexWorkaround: latexWorkaround, | ||
89 | ), | 92 | ), |
90 | ), | 93 | ), |
91 | ), | 94 | ), |
@@ -117,6 +120,7 @@ class MdWidget extends StatelessWidget { | @@ -117,6 +120,7 @@ class MdWidget extends StatelessWidget { | ||
117 | style, | 120 | style, |
118 | textDirection, | 121 | textDirection, |
119 | onLinkTab, | 122 | onLinkTab, |
123 | + latexWorkaround, | ||
120 | ), | 124 | ), |
121 | ); | 125 | ); |
122 | } | 126 | } |
-
Please register or login to post a comment