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-12-27 19:47:39 +0600
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f8061132888745e1339648c7996e5780cb4f0498
f8061132
1 parent
e94d28dc
Bug fixes
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
17 deletions
example/lib/main.dart
lib/custom_widgets/markdow_config.dart
lib/markdown_component.dart
example/lib/main.dart
View file @
f806113
...
...
@@ -395,7 +395,7 @@ Markdown and LaTeX can be powerful tools for formatting text and mathematical ex
),
if (writingMod)
ConstrainedBox(
constraints: const BoxConstraints(maxHeight:
2
00),
constraints: const BoxConstraints(maxHeight:
4
00),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
...
...
lib/custom_widgets/markdow_config.dart
View file @
f806113
...
...
@@ -68,7 +68,7 @@ class GptMarkdownConfig {
);
}
getRich
(
InlineSpan
span
)
{
Text
getRich
(
InlineSpan
span
)
{
return
Text
.
rich
(
span
,
textDirection:
textDirection
,
...
...
lib/markdown_component.dart
View file @
f806113
...
...
@@ -12,8 +12,8 @@ abstract class MarkdownComponent {
RadioButtonMd
(),
CheckBoxMd
(),
HrLine
(),
LatexMathMultiLine
(),
IndentMd
(),
LatexMathMultyLine
(),
LatexMath
(),
ImageMd
(),
HighlightedText
(),
...
...
@@ -145,9 +145,10 @@ abstract class BlockMd extends MarkdownComponent {
text
,
config
,
);
length
=
min
(
length
,
4
);
if
(
length
>
0
)
{
child
=
UnorderedListView
(
spacing:
length
.
toDouble
()
*
6
,
spacing:
length
*
6.0
,
child:
child
,
);
}
...
...
@@ -306,7 +307,7 @@ class RadioButtonMd extends BlockMd {
class
IndentMd
extends
InlineMd
{
@override
RegExp
get
exp
=>
RegExp
(
r"^(\ +)(((?!
\n\n
).)+)$"
,
dotAll:
true
,
multiLine:
true
);
RegExp
(
r"^(\ +)(((?!
(\n\n|\n\ )
).)+)$"
,
dotAll:
true
,
multiLine:
true
);
@override
InlineSpan
span
(
...
...
@@ -317,7 +318,7 @@ class IndentMd extends InlineMd {
var
match
=
exp
.
firstMatch
(
text
);
int
spaces
=
(
match
?[
1
]
??
""
).
length
;
var
data
=
"
${match?[2]}
"
.
trim
();
data
.
replaceAll
(
RegExp
(
r'\n\ *
'
),
'
\n
'
).
trim
();
data
=
data
.
replaceAll
(
RegExp
(
r'\n\ {'
'
$spaces
'
'}
'
),
'
\n
'
).
trim
();
var
child
=
TextSpan
(
children:
MarkdownComponent
.
generate
(
context
,
...
...
@@ -330,17 +331,16 @@ class IndentMd extends InlineMd {
}
return
TextSpan
(
children:
[
const
TextSpan
(
text:
'
\n
'
),
WidgetSpan
(
child:
UnorderedListView
(
bulletColor:
config
.
style
?.
color
,
padding:
spaces
*
5
,
bulletSize:
0
,
textDirection:
config
.
textDirection
,
child:
Text
.
rich
(
child
),
child:
Row
(
children:
[
const
SizedBox
(
width:
20
,
),
Expanded
(
child:
config
.
getRich
(
child
)),
],
),
),
const
TextSpan
(
text:
'
\n
'
),
],
);
}
...
...
@@ -520,7 +520,7 @@ class ItalicMd extends InlineMd {
}
}
class
LatexMathMult
y
Line
extends
BlockMd
{
class
LatexMathMult
i
Line
extends
BlockMd
{
@override
String
get
expString
=>
(
r"\\\[(((?!\n\n).)*)\\\]|(\\begin.*?\\end{.*?})"
);
@override
...
...
@@ -701,7 +701,7 @@ class SourceTag extends InlineMd {
/// Link text component
class
ATagMd
extends
InlineMd
{
@override
RegExp
get
exp
=>
RegExp
(
r"\[([^\s\*][^\n]*?[^\s]?)?\]\(([^\s\*]+)?\)"
);
RegExp
get
exp
=>
RegExp
(
r"\[([^\s\*][^\n]*?[^\s]?)?\]\(([^\s\*]+
?
)?\)"
);
@override
InlineSpan
span
(
...
...
@@ -731,7 +731,7 @@ class ATagMd extends InlineMd {
/// Image component
class
ImageMd
extends
InlineMd
{
@override
RegExp
get
exp
=>
RegExp
(
r"\!\[([^\s][^\n]*[^\s]?)?\]\(([^\s]+)\)"
);
RegExp
get
exp
=>
RegExp
(
r"\!\[([^\s][^\n]*[^\s]?)?\]\(([^\s]+
?
)\)"
);
@override
InlineSpan
span
(
...
...
Please
register
or
login
to post a comment