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-16 11:15:46 +0600
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
dc0c9d9b6394255a067c78f9a7871f879e59b4c1
dc0c9d9b
1 parent
4516fdbd
Table work arround added
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
14 deletions
gpt_markdown/example/lib/main.dart
gpt_markdown/lib/md_widget.dart
gpt_markdown/example/lib/main.dart
View file @
dc0c9d9
...
...
@@ -134,8 +134,7 @@ Markdown and LaTeX can be powerful tools for formatting text and mathematical ex
width: 1,
color: Theme.of(context).colorScheme.outline),
),
child:
LayoutBuilder(builder: (context, constraints) {
child: LayoutBuilder(builder: (context, constraints) {
return Theme(
data: Theme.of(context).copyWith(
textTheme: const TextTheme(
...
...
@@ -167,9 +166,8 @@ Markdown and LaTeX can be powerful tools for formatting text and mathematical ex
// Regular text font size here.
fontSize: 15,
),
latexWorkaround: (tex) =>
tex.replaceAllMapped(RegExp(r"align
\
*"),
(match) => "aligned"),
latexWorkaround: (tex) => tex.replaceAllMapped(
RegExp(r"align
\
*"), (match) => "aligned"),
latexBuilder: (contex, tex) {
if (tex.contains(r"
\
begin{tabular}")) {
// return table.
...
...
@@ -180,7 +178,12 @@ Markdown and LaTeX can be powerful tools for formatting text and mathematical ex
).firstMatch(tex)?[1] ?? "").trim()}|";
tableString = tableString
.replaceAll(r"
\\
", "|
\n
|")
.replaceAll("&", "|");
.replaceAll(r"
\
hline", "")
.replaceAll(RegExp(r"(?<!
\\
)&"), "|");
var tableStringList = tableString
.split("
\n
")
..insert(1, "|---|");
tableString = tableStringList.join("
\n
");
return TexMarkdown(tableString);
}
var controller = ScrollController();
...
...
gpt_markdown/lib/md_widget.dart
View file @
dc0c9d9
...
...
@@ -102,17 +102,23 @@ class MdWidget extends StatelessWidget {
(
index
)
{
var
e
=
entry
.
value
;
String
data
=
e
[
index
]
??
""
;
if
(
RegExp
(
r"^--+$"
).
hasMatch
(
data
.
trim
()))
{
if
(
RegExp
(
r"^--+$"
).
hasMatch
(
data
.
trim
())
||
data
.
trim
().
isEmpty
)
{
return
const
SizedBox
();
}
return
Center
(
child:
MdWidget
(
(
e
[
index
]
??
""
).
trim
(),
textDirection:
textDirection
,
onLinkTab:
onLinkTab
,
style:
style
,
latexWorkaround:
latexWorkaround
,
latexBuilder:
latexBuilder
,
child:
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
8
,
vertical:
4
),
child:
MdWidget
(
(
e
[
index
]
??
""
).
trim
(),
textDirection:
textDirection
,
onLinkTab:
onLinkTab
,
style:
style
,
latexWorkaround:
latexWorkaround
,
latexBuilder:
latexBuilder
,
),
),
);
},
...
...
Please
register
or
login
to post a comment