summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-07-13 11:41:03 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2016-07-13 11:41:03 -0700
commita47d3332c073ec3d0420d0b7947544b0f26d910f (patch)
tree99884a81b191b1301a6e4b069358d01f6a623882
parentfb737bd9dfe1aa03767fe01fc1d28ed46652158b (diff)
Empty list items cannot interrupt paragraphs (spec change).
-rw-r--r--src/blocks.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/blocks.c b/src/blocks.c
index a5e667e..84d20a4 100644
--- a/src/blocks.c
+++ b/src/blocks.c
@@ -388,6 +388,7 @@ static bufsize_t parse_list_marker(cmark_mem *mem, cmark_chunk *input,
unsigned char c;
bufsize_t startpos;
cmark_list *data;
+ bufsize_t i;
startpos = pos;
c = peek_at(input, pos);
@@ -397,6 +398,18 @@ static bufsize_t parse_list_marker(cmark_mem *mem, cmark_chunk *input,
if (!cmark_isspace(peek_at(input, pos))) {
return 0;
}
+
+ if (interrupts_paragraph) {
+ i = pos;
+ // require non-blank content after list marker:
+ while (S_is_space_or_tab(peek_at(input, i))) {
+ i++;
+ }
+ if (peek_at(input, i) == '\n') {
+ return 0;
+ }
+ }
+
data = (cmark_list *)mem->calloc(1, sizeof(*data));
data->marker_offset = 0; // will be adjusted later
data->list_type = CMARK_BULLET_LIST;
@@ -426,6 +439,17 @@ static bufsize_t parse_list_marker(cmark_mem *mem, cmark_chunk *input,
if (!cmark_isspace(peek_at(input, pos))) {
return 0;
}
+ if (interrupts_paragraph) {
+ // require non-blank content after list marker:
+ i = pos;
+ while (S_is_space_or_tab(peek_at(input, i))) {
+ i++;
+ }
+ if (peek_at(input, i) == '\n') {
+ return 0;
+ }
+ }
+
data = (cmark_list *)mem->calloc(1, sizeof(*data));
data->marker_offset = 0; // will be adjusted later
data->list_type = CMARK_ORDERED_LIST;