瀏覽代碼

test: markdown decoder test

Lucas.Xu 2 年之前
父節點
當前提交
888c1b86f0

+ 7 - 0
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';
   }

+ 1 - 2
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!''');
     });
   });
 }