@@ -259,15 +259,18 @@ static void remove_trailing_blank_lines(cmark_strbuf *ln) {
259
259
// Check to see if a node ends with a blank line, descending
260
260
// if needed into lists and sublists.
261
261
static bool S_ends_with_blank_line (cmark_node * node ) {
262
- if (S_last_line_checked (node )) {
263
- return (S_last_line_blank (node ));
264
- } else if ((S_type (node ) == CMARK_NODE_LIST ||
265
- S_type (node ) == CMARK_NODE_ITEM ) && node -> last_child ) {
266
- S_set_last_line_checked (node );
267
- return (S_ends_with_blank_line (node -> last_child ));
268
- } else {
269
- S_set_last_line_checked (node );
270
- return (S_last_line_blank (node ));
262
+ while (true) {
263
+ if (S_last_line_checked (node )) {
264
+ return (S_last_line_blank (node ));
265
+ } else if ((S_type (node ) == CMARK_NODE_LIST ||
266
+ S_type (node ) == CMARK_NODE_ITEM ) && node -> last_child ) {
267
+ S_set_last_line_checked (node );
268
+ node = node -> last_child ;
269
+ continue ;
270
+ } else {
271
+ S_set_last_line_checked (node );
272
+ return (S_last_line_blank (node ));
273
+ }
271
274
}
272
275
}
273
276
@@ -1137,6 +1140,7 @@ static cmark_node *check_open_blocks(cmark_parser *parser, cmark_chunk *input,
1137
1140
// fall through
1138
1141
case CMARK_NODE_CODE_BLOCK :
1139
1142
case CMARK_NODE_PARAGRAPH :
1143
+ case CMARK_NODE_HTML_BLOCK :
1140
1144
// Jump to parser->current
1141
1145
container = parser -> current ;
1142
1146
cont_type = S_type (container );
0 commit comments