File tree 2 files changed +17
-1
lines changed
2 files changed +17
-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 @@ -301,6 +301,21 @@ class ContentExample {
301
301
'\n </code></pre></div>' ),
302
302
]);
303
303
304
+ static const lineBreaksAfterCodeBlocks = ContentExample (
305
+ 'blank text nodes after code blocks' ,
306
+ ' code block.\n\n some content' ,
307
+ '<div class="codehilite">'
308
+ '<pre><span></span><code>'
309
+ 'code block.\n '
310
+ '</code></pre>'
311
+ '</div>\n\n '
312
+ '<p>'
313
+ 'some content'
314
+ '</p>' , [
315
+ CodeBlockNode ([CodeBlockSpanNode (text: "code block." , type: CodeBlockSpanType .text)]),
316
+ ParagraphNode (links: null , nodes: [TextNode ("some content" )]),
317
+ ]);
318
+
304
319
static final mathInline = ContentExample .inline (
305
320
'inline math' ,
306
321
r"$$ \lambda $$" ,
@@ -843,6 +858,7 @@ void main() {
843
858
testParseExample (ContentExample .codeBlockHighlightedMultiline);
844
859
testParseExample (ContentExample .codeBlockWithHighlightedLines);
845
860
testParseExample (ContentExample .codeBlockWithUnknownSpanType);
861
+ testParseExample (ContentExample .lineBreaksAfterCodeBlocks);
846
862
847
863
testParseExample (ContentExample .mathBlock);
848
864
testParseExample (ContentExample .mathBlockInQuote);
You can’t perform that action at this time.
0 commit comments