File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -1107,7 +1107,7 @@ class _ZulipContentParser {
1107
1107
for (final node in nodes) {
1108
1108
// We get a bunch of newline Text nodes between paragraphs.
1109
1109
// A browser seems to ignore these; let's do the same.
1110
- if (node is dom.Text && (node.text == ' \n ' )) continue ;
1110
+ if (node is dom.Text && RegExp ( r'^(\n+)$' ). hasMatch (node.text )) continue ;
1111
1111
1112
1112
final block = parseBlockContent (node);
1113
1113
if (block is ImageNode ) {
Original file line number Diff line number Diff line change @@ -521,6 +521,21 @@ class ContentExample {
521
521
blockUnimplemented ('more text' ),
522
522
]]),
523
523
]);
524
+
525
+ static const lineBreaksAfterCodeBlocks = ContentExample (
526
+ 'blank text nodes after code blocks' ,
527
+ ' code block''\n\n ''some content' ,
528
+ '<div class="codehilite">'
529
+ '<pre><code>'
530
+ 'code block.\n '
531
+ '</code></pre>'
532
+ '</div>\n\n '
533
+ '<p>'
534
+ 'some content'
535
+ '</p>' , [
536
+ CodeBlockNode ([CodeBlockSpanNode (text: "code block." , type: CodeBlockSpanType .text)]),
537
+ ParagraphNode (links: null , nodes: [TextNode ("some content" )]),
538
+ ]);
524
539
}
525
540
526
541
UnimplementedBlockContentNode blockUnimplemented (String html) {
@@ -875,6 +890,8 @@ void main() {
875
890
]]),
876
891
]);
877
892
893
+ testParseExample (ContentExample .lineBreaksAfterCodeBlocks);
894
+
878
895
test ('all content examples are tested' , () {
879
896
// Check that every ContentExample defined above has a corresponding
880
897
// actual test case that runs on it. If you've added a new example
You can’t perform that action at this time.
0 commit comments