Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions api_test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,20 @@ static void render_commonmark(test_batch_runner *runner) {
STR_EQ(runner, commonmark, "Hi", "render single inline node");
free(commonmark);

static const char empty_item[] = "> - a\n"
"> -\n"
"> - b\n";
cmark_node *empty_item_doc =
cmark_parse_document(empty_item, sizeof(empty_item) - 1,
CMARK_OPT_DEFAULT);
commonmark = cmark_render_commonmark(empty_item_doc, CMARK_OPT_DEFAULT, 0);
STR_EQ(runner, commonmark, "> - a\n"
"> - \n"
"> - b\n",
"render empty list item inside block quote");
free(commonmark);

cmark_node_free(empty_item_doc);
cmark_node_free(text);
cmark_node_free(doc);
}
Expand Down
7 changes: 5 additions & 2 deletions src/commonmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,11 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
}
}
} else {
cmark_strbuf_truncate(renderer->prefix,
renderer->prefix->size - marker_width);
// the prefix spaces are only pushed when the item has children:
if (node->first_child != NULL) {
cmark_strbuf_truncate(renderer->prefix,
renderer->prefix->size - marker_width);
}
CR();
}
break;
Expand Down
Loading