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 978e04f9005ef0eb217571c6f58e88759356ca2a
parent d9e28dc99ef32f09ce86f04125c1b8ae3e42a2e6
Author: Martin Mitas <mity@morous.org>
Date:   Sun,  9 Oct 2016 01:12:56 +0200

Minor cleanup.

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

diff --git a/md4c/md4c.c b/md4c/md4c.c @@ -1071,8 +1071,6 @@ md_process_inlines(MD_CTX* ctx, const MD_LINE* lines, int n_lines) /* If reached end of line, move to next one. */ if(off >= line->end) { - MD_TEXTTYPE break_type; - /* If it is the last line, we are done. */ if(off >= end) break; @@ -1088,10 +1086,15 @@ md_process_inlines(MD_CTX* ctx, const MD_LINE* lines, int n_lines) MD_TEXT(MD_SPAN_CODE, _T(" "), 1); } else { /* Output soft or hard line break. */ - if(enforce_hardbreak || (CH(line->end) == _T(' ') && CH(line->end+1) == _T(' '))) - break_type = MD_TEXT_BR; - else - break_type = MD_TEXT_SOFTBR; + MD_TEXTTYPE break_type = MD_TEXT_SOFTBR; + + if(text_type == MD_TEXT_NORMAL) { + if(enforce_hardbreak) + break_type = MD_TEXT_BR; + else if((CH(line->end) == _T(' ') && CH(line->end+1) == _T(' '))) + break_type = MD_TEXT_BR; + } + MD_TEXT(break_type, _T("\n"), 1); }