md4c

C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
git clone https://noulin.net/git/md4c.git
Log | Files | Refs | README | LICENSE

commit e7908d566df0af26bc12e732ad2d455dae2e965c
parent 325f373ee72dae72888c1e55b0d977425591c096
Author: Martin Mitas <mity@morous.org>
Date:   Thu,  1 Dec 2016 11:29:42 +0100

md_analyze_line: Handle better indentation after list item mark.

Diffstat:
Mmd4c/md4c.c | 20+++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/md4c/md4c.c b/md4c/md4c.c @@ -4754,8 +4754,6 @@ md_analyze_line(MD_CTX* ctx, OFF beg, OFF* p_end, /* Block quote mark. */ off++; total_indent++; - //if(off < ctx->size && CH(off) == _T(' ')) - //off++; line->indent = md_line_indentation(ctx, total_indent, off, &off); total_indent += line->indent; @@ -4896,19 +4894,19 @@ redo: if(md_is_container_mark(ctx, line->indent, off, &off, &container)) { total_indent += container.contents_indent - container.mark_indent; - /* One following space (if present) is part of the mark. - * (Note '\t' stands for spaces up to the next tab stop.) */ - if(off < ctx->size && ISBLANK(off)) { - container.contents_indent++; - total_indent++; - if(CH(off) != _T('\t') || (total_indent & 3) == 3) - off++; - } - line->indent = md_line_indentation(ctx, total_indent, off, &off); total_indent += line->indent; line->beg = off; + /* Some of the following whitespace actually still belongs to the mark. */ + if(line->indent <= 4) { + container.contents_indent += line->indent; + line->indent = 0; + } else { + container.contents_indent += 1; + line->indent--; + } + if(n_brothers + n_children == 0) { pivot_line = &md_dummy_blank_line;