Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

test: markdown decoder test

Lucas.Xu888c1b86f00c
diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/plugins/markdown/encoder/parser/text_node_parser.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/plugins/markdown/encoder/parser/text_node_parser.dart
index fe60db7c7e..8857310876 100644
--- a/frontend/app_flowy/packages/appflowy_editor/lib/src/plugins/markdown/encoder/parser/text_node_parser.dart
+++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/plugins/markdown/encoder/parser/text_node_parser.dart
@@ -20,6 +20,9 @@ class TextNodeParser extends NodeParser {
if (attributes.isNotEmpty &&
attributes.containsKey(BuiltInAttributeKey.subtype)) {
final subtype = attributes[BuiltInAttributeKey.subtype];
+ if (node.next == null) {
+ suffix = '';
+ }
if (subtype == 'heading') {
final heading = attributes[BuiltInAttributeKey.heading];
if (heading == 'h1') {
@@ -51,6 +54,10 @@ class TextNodeParser extends NodeParser {
result = '- [ ] $markdown';
}
}
+ } else {
+ if (node.next == null) {
+ suffix = '';
+ }
}
return '$result$suffix';
}
diff --git a/frontend/app_flowy/packages/appflowy_editor/test/plugins/markdown/encoder/document_markdown_encoder_test.dart b/frontend/app_flowy/packages/appflowy_editor/test/plugins/markdown/encoder/document_markdown_encoder_test.dart
index a81ff10a62..0c3fdb0254 100644
--- a/frontend/app_flowy/packages/appflowy_editor/test/plugins/markdown/encoder/document_markdown_encoder_test.dart
+++ b/frontend/app_flowy/packages/appflowy_editor/test/plugins/markdown/encoder/document_markdown_encoder_test.dart
@@ -130,8 +130,7 @@ You can also use ***AppFlowy Editor*** as a component to build your own app.
* Use / to insert blocks
* Select text to trigger to the toolbar to format your notes.
-If you have questions or feedback, please submit an issue on Github or join the community along with 1000+ builders!
-''');
+If you have questions or feedback, please submit an issue on Github or join the community along with 1000+ builders!''');
});
});
}