simplified code across the app and consolidated duplicated helpers
This commit is contained in:
@@ -53,9 +53,11 @@ String markdownToPlainText(String source) {
|
||||
|
||||
final buffer = StringBuffer();
|
||||
_collect(nodes, buffer);
|
||||
return buffer.toString().replaceAll(RegExp(r'\s+'), ' ').trim();
|
||||
return buffer.toString().replaceAll(_whitespace, ' ').trim();
|
||||
}
|
||||
|
||||
final _whitespace = RegExp(r'\s+');
|
||||
|
||||
void _collect(List<md.Node> nodes, StringBuffer buffer) {
|
||||
for (final node in nodes) {
|
||||
if (node is md.Text) {
|
||||
|
||||
Reference in New Issue
Block a user