diff options
Diffstat (limited to 'src/blocks.c')
-rw-r--r-- | src/blocks.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/blocks.c b/src/blocks.c index a5e667e..7627f6e 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 (S_is_line_end_char(peek_at(input, i))) { + return 0; + } + } + data = (cmark_list *)mem->calloc(1, sizeof(*data)); data->marker_offset = 0; // will be adjusted later data->list_type = CMARK_ORDERED_LIST; |