Skip to content

Commit b4138c5

Browse files
committed
In ends_with_blank_line, call S_set_last_line_blank...
to avoid unnecessary repetition. Once we settle whether a list item ends in a blank line, we don't need to revisit this in considering parent list items. See commonmark#284.
1 parent 478195c commit b4138c5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/blocks.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ static bool ends_with_blank_line(cmark_node *node) {
211211
cmark_node *cur = node;
212212
while (cur != NULL) {
213213
if (S_last_line_blank(cur)) {
214+
S_set_last_line_blank(node, true);
214215
return true;
215216
}
216217
if (S_type(cur) == CMARK_NODE_LIST || S_type(cur) == CMARK_NODE_ITEM) {
@@ -219,6 +220,7 @@ static bool ends_with_blank_line(cmark_node *node) {
219220
cur = NULL;
220221
}
221222
}
223+
S_set_last_line_blank(node, false);
222224
return false;
223225
}
224226

0 commit comments

Comments
 (0)