Skip to content

Commit

Permalink
In ends_with_blank_line, call S_set_last_line_blank...
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jgm committed Mar 17, 2019
1 parent 28745fd commit 441ac86
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/blocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ static bool ends_with_blank_line(cmark_node *node) {
cmark_node *cur = node;
while (cur != NULL) {
if (S_last_line_blank(cur)) {
S_set_last_line_blank(node, true);
return true;
}
if (S_type(cur) == CMARK_NODE_LIST || S_type(cur) == CMARK_NODE_ITEM) {
Expand All @@ -219,6 +220,7 @@ static bool ends_with_blank_line(cmark_node *node) {
cur = NULL;
}
}
S_set_last_line_blank(node, false);
return false;
}

Expand Down

0 comments on commit 441ac86

Please sign in to comment.