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
saminsohag
2024-02-17 11:17:09 +0600
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1d1dc38504fe36d13a8e0aeb0609c10c96f97a82
1d1dc385
1 parent
414cd6b6
.$ syntex added with a gard condition for \(_\)
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
gpt_markdown/README.md
gpt_markdown/example/lib/main.dart
gpt_markdown/lib/gpt_markdown.dart
gpt_markdown/README.md
View file @
1d1dc38
gpt_markdown/example/lib/main.dart
View file @
1d1dc38
...
...
@@ -161,7 +161,7 @@ Markdown and LaTeX can be powerful tools for formatting text and mathematical ex
},
textAlign: TextAlign.justify,
// textScaler: const TextScaler.linear(1.3),
textScaleFactor: 1
.7
,
textScaleFactor: 1,
style: const TextStyle(
// Regular text font size here.
fontSize: 15,
...
...
gpt_markdown/lib/gpt_markdown.dart
View file @
1d1dc38
...
...
@@ -30,9 +30,29 @@ class TexMarkdown extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
String
tex
=
data
.
trim
();
if
(!
tex
.
contains
(
r"\("
))
{
tex
=
tex
.
replaceAllMapped
(
RegExp
(
r"(?<!\\)\$\$(.*?)(?<!\\)\$\$"
,
),
(
match
)
=>
"
\\
[
${match[1] ?? ""}
\\
]"
)
.
replaceAllMapped
(
RegExp
(
r"(?<!\\)\$(.*?)(?<!\\)\$"
,
),
(
match
)
=>
"
\\
(
${match[1] ?? ""}
\\
)"
);
tex
=
tex
.
splitMapJoin
(
RegExp
(
r"\[.*?\]|\(.*?\)"
),
onNonMatch:
(
p0
)
{
return
p0
.
replaceAll
(
"
\\
\$
"
,
"
\$
"
);
},
);
}
return
ClipRRect
(
child:
MdWidget
(
data
.
trim
()
,
tex
,
textDirection:
textDirection
,
style:
style
,
onLinkTab:
onLinkTab
,
...
...
Please
register
or
login
to post a comment