Showing
10 changed files
with
57 additions
and
15 deletions
| @@ -383,8 +383,8 @@ This document was created to test the robustness of Markdown parsers and to ensu | @@ -383,8 +383,8 @@ This document was created to test the robustness of Markdown parsers and to ensu | ||
| 383 | Expanded( | 383 | Expanded( |
| 384 | child: ListView( | 384 | child: ListView( |
| 385 | children: [ | 385 | children: [ |
| 386 | - AnimatedBuilder( | ||
| 387 | - animation: _controller, | 386 | + ListenableBuilder( |
| 387 | + listenable: _controller, | ||
| 388 | builder: (context, _) { | 388 | builder: (context, _) { |
| 389 | return Container( | 389 | return Container( |
| 390 | padding: const EdgeInsets.all(8), | 390 | padding: const EdgeInsets.all(8), |
| @@ -86,6 +86,14 @@ packages: | @@ -86,6 +86,14 @@ packages: | ||
| 86 | description: flutter | 86 | description: flutter |
| 87 | source: sdk | 87 | source: sdk |
| 88 | version: "0.0.0" | 88 | version: "0.0.0" |
| 89 | + flutter_highlight: | ||
| 90 | + dependency: transitive | ||
| 91 | + description: | ||
| 92 | + name: flutter_highlight | ||
| 93 | + sha256: "7b96333867aa07e122e245c033b8ad622e4e3a42a1a2372cbb098a2541d8782c" | ||
| 94 | + url: "https://pub.dev" | ||
| 95 | + source: hosted | ||
| 96 | + version: "0.7.0" | ||
| 89 | flutter_lints: | 97 | flutter_lints: |
| 90 | dependency: "direct dev" | 98 | dependency: "direct dev" |
| 91 | description: | 99 | description: |
| @@ -127,6 +135,14 @@ packages: | @@ -127,6 +135,14 @@ packages: | ||
| 127 | relative: true | 135 | relative: true |
| 128 | source: path | 136 | source: path |
| 129 | version: "1.0.16" | 137 | version: "1.0.16" |
| 138 | + highlight: | ||
| 139 | + dependency: transitive | ||
| 140 | + description: | ||
| 141 | + name: highlight | ||
| 142 | + sha256: "5353a83ffe3e3eca7df0abfb72dcf3fa66cc56b953728e7113ad4ad88497cf21" | ||
| 143 | + url: "https://pub.dev" | ||
| 144 | + source: hosted | ||
| 145 | + version: "0.7.0" | ||
| 130 | http: | 146 | http: |
| 131 | dependency: transitive | 147 | dependency: transitive |
| 132 | description: | 148 | description: |
| @@ -72,7 +72,13 @@ class _CodeFieldState extends State<CodeField> { | @@ -72,7 +72,13 @@ class _CodeFieldState extends State<CodeField> { | ||
| 72 | SingleChildScrollView( | 72 | SingleChildScrollView( |
| 73 | scrollDirection: Axis.horizontal, | 73 | scrollDirection: Axis.horizontal, |
| 74 | padding: const EdgeInsets.all(16), | 74 | padding: const EdgeInsets.all(16), |
| 75 | - child: Text(widget.codes), | 75 | + child: Text( |
| 76 | + widget.codes, | ||
| 77 | + style: TextStyle( | ||
| 78 | + fontFamily: 'JetBrainsMono', | ||
| 79 | + package: "gpt_markdown", | ||
| 80 | + ), | ||
| 81 | + ), | ||
| 76 | ), | 82 | ), |
| 77 | ], | 83 | ], |
| 78 | ), | 84 | ), |
| @@ -24,6 +24,7 @@ class CustomRb extends StatelessWidget { | @@ -24,6 +24,7 @@ class CustomRb extends StatelessWidget { | ||
| 24 | return Directionality( | 24 | return Directionality( |
| 25 | textDirection: textDirection, | 25 | textDirection: textDirection, |
| 26 | child: Row( | 26 | child: Row( |
| 27 | + mainAxisSize: MainAxisSize.min, | ||
| 27 | textBaseline: TextBaseline.alphabetic, | 28 | textBaseline: TextBaseline.alphabetic, |
| 28 | crossAxisAlignment: CrossAxisAlignment.baseline, | 29 | crossAxisAlignment: CrossAxisAlignment.baseline, |
| 29 | children: [ | 30 | children: [ |
| @@ -44,7 +45,7 @@ class CustomRb extends StatelessWidget { | @@ -44,7 +45,7 @@ class CustomRb extends StatelessWidget { | ||
| 44 | ), | 45 | ), |
| 45 | ), | 46 | ), |
| 46 | ), | 47 | ), |
| 47 | - Expanded(child: child), | 48 | + Flexible(child: child), |
| 48 | ], | 49 | ], |
| 49 | ), | 50 | ), |
| 50 | ); | 51 | ); |
| @@ -75,6 +76,7 @@ class CustomCb extends StatelessWidget { | @@ -75,6 +76,7 @@ class CustomCb extends StatelessWidget { | ||
| 75 | return Directionality( | 76 | return Directionality( |
| 76 | textDirection: textDirection, | 77 | textDirection: textDirection, |
| 77 | child: Row( | 78 | child: Row( |
| 79 | + mainAxisSize: MainAxisSize.min, | ||
| 78 | textBaseline: TextBaseline.alphabetic, | 80 | textBaseline: TextBaseline.alphabetic, |
| 79 | crossAxisAlignment: CrossAxisAlignment.baseline, | 81 | crossAxisAlignment: CrossAxisAlignment.baseline, |
| 80 | children: [ | 82 | children: [ |
| @@ -90,7 +92,7 @@ class CustomCb extends StatelessWidget { | @@ -90,7 +92,7 @@ class CustomCb extends StatelessWidget { | ||
| 90 | ), | 92 | ), |
| 91 | ), | 93 | ), |
| 92 | ), | 94 | ), |
| 93 | - Expanded(child: child), | 95 | + Flexible(child: child), |
| 94 | ], | 96 | ], |
| 95 | ), | 97 | ), |
| 96 | ); | 98 | ); |
| @@ -38,6 +38,7 @@ class UnorderedListView extends StatelessWidget { | @@ -38,6 +38,7 @@ class UnorderedListView extends StatelessWidget { | ||
| 38 | return Directionality( | 38 | return Directionality( |
| 39 | textDirection: textDirection, | 39 | textDirection: textDirection, |
| 40 | child: Row( | 40 | child: Row( |
| 41 | + mainAxisSize: MainAxisSize.min, | ||
| 41 | textBaseline: TextBaseline.alphabetic, | 42 | textBaseline: TextBaseline.alphabetic, |
| 42 | crossAxisAlignment: CrossAxisAlignment.baseline, | 43 | crossAxisAlignment: CrossAxisAlignment.baseline, |
| 43 | children: [ | 44 | children: [ |
| @@ -63,7 +64,7 @@ class UnorderedListView extends StatelessWidget { | @@ -63,7 +64,7 @@ class UnorderedListView extends StatelessWidget { | ||
| 63 | ), | 64 | ), |
| 64 | ), | 65 | ), |
| 65 | ), | 66 | ), |
| 66 | - Expanded(child: child), | 67 | + Flexible(child: child), |
| 67 | ], | 68 | ], |
| 68 | ), | 69 | ), |
| 69 | ); | 70 | ); |
| @@ -104,6 +105,7 @@ class OrderedListView extends StatelessWidget { | @@ -104,6 +105,7 @@ class OrderedListView extends StatelessWidget { | ||
| 104 | return Directionality( | 105 | return Directionality( |
| 105 | textDirection: textDirection, | 106 | textDirection: textDirection, |
| 106 | child: Row( | 107 | child: Row( |
| 108 | + mainAxisSize: MainAxisSize.min, | ||
| 107 | textBaseline: TextBaseline.alphabetic, | 109 | textBaseline: TextBaseline.alphabetic, |
| 108 | crossAxisAlignment: CrossAxisAlignment.baseline, | 110 | crossAxisAlignment: CrossAxisAlignment.baseline, |
| 109 | children: [ | 111 | children: [ |
| @@ -111,7 +113,7 @@ class OrderedListView extends StatelessWidget { | @@ -111,7 +113,7 @@ class OrderedListView extends StatelessWidget { | ||
| 111 | padding: EdgeInsetsDirectional.only(start: padding, end: spacing), | 113 | padding: EdgeInsetsDirectional.only(start: padding, end: spacing), |
| 112 | child: Text.rich(TextSpan(text: no), style: _style), | 114 | child: Text.rich(TextSpan(text: no), style: _style), |
| 113 | ), | 115 | ), |
| 114 | - Expanded(child: child), | 116 | + Flexible(child: child), |
| 115 | ], | 117 | ], |
| 116 | ), | 118 | ), |
| 117 | ); | 119 | ); |
lib/fonts/JetBrainsMono-Regular.ttf
0 → 100644
No preview for this file type
| @@ -112,7 +112,8 @@ abstract class BlockMd extends MarkdownComponent { | @@ -112,7 +112,8 @@ abstract class BlockMd extends MarkdownComponent { | ||
| 112 | bool get inline => false; | 112 | bool get inline => false; |
| 113 | 113 | ||
| 114 | @override | 114 | @override |
| 115 | - RegExp get exp => RegExp(r'^\ *?' + expString, dotAll: true, multiLine: true); | 115 | + RegExp get exp => |
| 116 | + RegExp(r'^\ *?' + expString + r"$", dotAll: true, multiLine: true); | ||
| 116 | 117 | ||
| 117 | String get expString; | 118 | String get expString; |
| 118 | 119 | ||
| @@ -134,7 +135,10 @@ abstract class BlockMd extends MarkdownComponent { | @@ -134,7 +135,10 @@ abstract class BlockMd extends MarkdownComponent { | ||
| 134 | child: child, | 135 | child: child, |
| 135 | ); | 136 | ); |
| 136 | } | 137 | } |
| 137 | - child = Row(children: [Flexible(child: child)]); | 138 | + child = Row( |
| 139 | + mainAxisSize: MainAxisSize.min, | ||
| 140 | + children: [Flexible(child: child)], | ||
| 141 | + ); | ||
| 138 | return WidgetSpan( | 142 | return WidgetSpan( |
| 139 | child: child, | 143 | child: child, |
| 140 | alignment: PlaceholderAlignment.baseline, | 144 | alignment: PlaceholderAlignment.baseline, |
| @@ -164,6 +168,7 @@ class IndentMd extends BlockMd { | @@ -164,6 +168,7 @@ class IndentMd extends BlockMd { | ||
| 164 | return Directionality( | 168 | return Directionality( |
| 165 | textDirection: config.textDirection, | 169 | textDirection: config.textDirection, |
| 166 | child: Row( | 170 | child: Row( |
| 171 | + mainAxisSize: MainAxisSize.min, | ||
| 167 | children: [ | 172 | children: [ |
| 168 | Flexible( | 173 | Flexible( |
| 169 | child: config.getRich( | 174 | child: config.getRich( |
| @@ -257,7 +262,7 @@ class NewLines extends InlineMd { | @@ -257,7 +262,7 @@ class NewLines extends InlineMd { | ||
| 257 | /// Horizontal line component | 262 | /// Horizontal line component |
| 258 | class HrLine extends BlockMd { | 263 | class HrLine extends BlockMd { |
| 259 | @override | 264 | @override |
| 260 | - String get expString => (r"(--)[-]+$"); | 265 | + String get expString => (r"⸻|((--)[-]+)$"); |
| 261 | @override | 266 | @override |
| 262 | Widget build( | 267 | Widget build( |
| 263 | BuildContext context, | 268 | BuildContext context, |
| @@ -554,10 +559,8 @@ class StrikeMd extends InlineMd { | @@ -554,10 +559,8 @@ class StrikeMd extends InlineMd { | ||
| 554 | /// Italic text component | 559 | /// Italic text component |
| 555 | class ItalicMd extends InlineMd { | 560 | class ItalicMd extends InlineMd { |
| 556 | @override | 561 | @override |
| 557 | - RegExp get exp => RegExp( | ||
| 558 | - r"(?<!\*)\*(?<!\s)(.+?)(?<!\s)\*(?!\*)|\_(?<!\s)(.+?)(?<!\s)\_", | ||
| 559 | - dotAll: true, | ||
| 560 | - ); | 562 | + RegExp get exp => |
| 563 | + RegExp(r"(?:(?<!\*)\*(?<!\s)(.+?)(?<!\s)\*(?!\*))", dotAll: true); | ||
| 561 | 564 | ||
| 562 | @override | 565 | @override |
| 563 | InlineSpan span( | 566 | InlineSpan span( |
| 1 | name: gpt_markdown | 1 | name: gpt_markdown |
| 2 | description: "Powerful Markdown & LaTeX Renderer for Flutter: Rich Text, Math, Tables, Links, and Text Selection. Ideal for ChatGPT, Gemini, and more." | 2 | description: "Powerful Markdown & LaTeX Renderer for Flutter: Rich Text, Math, Tables, Links, and Text Selection. Ideal for ChatGPT, Gemini, and more." |
| 3 | -version: 1.0.16 | 3 | +version: 1.0.17 |
| 4 | homepage: https://github.com/Infinitix-LLC/gpt_markdown | 4 | homepage: https://github.com/Infinitix-LLC/gpt_markdown |
| 5 | 5 | ||
| 6 | environment: | 6 | environment: |
| @@ -18,6 +18,10 @@ dev_dependencies: | @@ -18,6 +18,10 @@ dev_dependencies: | ||
| 18 | flutter_lints: ^5.0.0 | 18 | flutter_lints: ^5.0.0 |
| 19 | 19 | ||
| 20 | flutter: | 20 | flutter: |
| 21 | + fonts: | ||
| 22 | + - family: JetBrainsMono | ||
| 23 | + fonts: | ||
| 24 | + - asset: lib/fonts/JetBrainsMono-Regular.ttf | ||
| 21 | 25 | ||
| 22 | topics: | 26 | topics: |
| 23 | - markdown | 27 | - markdown |
-
Please register or login to post a comment