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 0832e11363c171f4aa238fedc1b073471b2c784a
parent 950b4d736cd934ef9934f596565c8014fb6ed57b
Author: Martin Mitas <mity@morous.org>
Date:   Sat,  8 Oct 2016 20:53:42 +0200

Fixes for parsing thematic breaks.

Diffstat:
Mmd4c/md4c.c | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/md4c/md4c.c b/md4c/md4c.c @@ -1182,6 +1182,10 @@ md_is_hr_line(MD_CTX* ctx, OFF beg, OFF* p_end) if(n < 3) return -1; + /* Nothing else can be present on the line. */ + if(off < ctx->size && !ISNEWLINE(off)) + return -1; + *p_end = off; return 0; } @@ -1577,8 +1581,9 @@ redo_indentation_after_blockquote_mark: } /* Check whether we are thematic break line. + * (We check the indentation to fix http://spec.commonmark.org/0.26/#example-19) * (Keep this after check for Setext underline as that one has higher priority). */ - if(ISANYOF(off, _T("-_*"))) { + if(line->indent < 4 && ISANYOF(off, _T("-_*"))) { if(md_is_hr_line(ctx, off, &off) == 0) { line->type = MD_LINE_HR; goto done;