Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
gpt_markdown
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
顾海波
2025-03-18 11:18:58 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e35ff2fac85e597b14c1f505da808dd794666505
e35ff2fa
1 parent
07d5cb00
【修复】markdown渲染问题
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
lib/gpt_markdown.dart
lib/gpt_markdown.dart
View file @
e35ff2f
...
...
@@ -108,10 +108,16 @@ class GptMarkdown extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
String
tex
=
data
.
trim
();
// print("texBefore:\n:$tex");
//去除 $$前面的空格 会导致渲染出错
tex
=
tex
.
replaceAllMapped
(
RegExp
(
r"(?<!\\)\$\$(.*?)(?<!\\)\$\$"
,
dotAll:
true
),
(
match
)
=>
"
\\
[
${match[1] ?? ""}
\\
]"
,
RegExp
(
r"(?<!\\)\s*\$\$(.*?)(?<!\\)\$\$"
,
dotAll:
true
),
(
match
)
=>
"
\n\\
[
${match[1] ?? ""}
\\
]"
,
);
// print("texAfter:\n:$tex");
if
(!
tex
.
contains
(
r"\("
))
{
tex
=
tex
.
replaceAllMapped
(
RegExp
(
r"(?<!\\)\$(.*?)(?<!\\)\$"
),
...
...
Please
register
or
login
to post a comment