saminsohag

underlined md added

... ... @@ -451,9 +451,9 @@ This document was created to test the robustness of Markdown parsers and to ensu
textAlign: TextAlign.justify,
textScaler: const TextScaler.linear(1),
style: const TextStyle(
fontFamily: 'monospace',
fontWeight: FontWeight.bold,
),
// fontFamily: 'monospace',
// fontWeight: FontWeight.bold,
),
highlightBuilder: (context, text, style) {
return Container(
padding: const EdgeInsets.symmetric(
... ...
... ... @@ -24,6 +24,7 @@ abstract class MarkdownComponent {
StrikeMd(),
BoldMd(),
ItalicMd(),
UnderLineMd(),
LatexMath(),
LatexMathMultiLine(),
HighlightedText(),
... ... @@ -1164,3 +1165,33 @@ class CodeBlockMd extends BlockMd {
CodeField(name: name, codes: codes);
}
}
class UnderLineMd extends InlineMd {
@override
RegExp get exp =>
RegExp(r"<u>(.*?)(?:</u>|$)", multiLine: true, dotAll: true);
@override
InlineSpan span(
BuildContext context,
String text,
final GptMarkdownConfig config,
) {
var match = exp.firstMatch(text.trim());
var conf = config.copyWith(
style: (config.style ?? const TextStyle()).copyWith(
decoration: TextDecoration.underline,
decorationColor: config.style?.color,
),
);
return TextSpan(
children: MarkdownComponent.generate(
context,
"${match?[1]}",
conf,
false,
),
style: conf.style,
);
}
}
... ...