Showing
1 changed file
with
8 additions
and
2 deletions
| @@ -108,10 +108,16 @@ class GptMarkdown extends StatelessWidget { | @@ -108,10 +108,16 @@ class GptMarkdown extends StatelessWidget { | ||
| 108 | @override | 108 | @override |
| 109 | Widget build(BuildContext context) { | 109 | Widget build(BuildContext context) { |
| 110 | String tex = data.trim(); | 110 | String tex = data.trim(); |
| 111 | + // print("texBefore:\n:$tex"); | ||
| 112 | + | ||
| 113 | + //去除 $$前面的空格 会导致渲染出错 | ||
| 111 | tex = tex.replaceAllMapped( | 114 | tex = tex.replaceAllMapped( |
| 112 | - RegExp(r"(?<!\\)\$\$(.*?)(?<!\\)\$\$", dotAll: true), | ||
| 113 | - (match) => "\\[${match[1] ?? ""}\\]", | 115 | + RegExp(r"(?<!\\)\s*\$\$(.*?)(?<!\\)\$\$", dotAll: true), |
| 116 | + (match) => "\n\\[${match[1] ?? ""}\\]", | ||
| 114 | ); | 117 | ); |
| 118 | + | ||
| 119 | + // print("texAfter:\n:$tex"); | ||
| 120 | + | ||
| 115 | if (!tex.contains(r"\(")) { | 121 | if (!tex.contains(r"\(")) { |
| 116 | tex = tex.replaceAllMapped( | 122 | tex = tex.replaceAllMapped( |
| 117 | RegExp(r"(?<!\\)\$(.*?)(?<!\\)\$"), | 123 | RegExp(r"(?<!\\)\$(.*?)(?<!\\)\$"), |
-
Please register or login to post a comment