diff --git a/src/md4c.c b/src/md4c.c index 3679526d..e3f5cf9d 100644 --- a/src/md4c.c +++ b/src/md4c.c @@ -4470,12 +4470,14 @@ md_process_inlines(MD_CTX* ctx, const MD_LINE* lines, MD_SIZE n_lines) MD_TEXTTYPE break_type = MD_TEXT_SOFTBR; if(text_type == MD_TEXT_NORMAL) { - if(ctx->parser.flags & MD_FLAG_HARD_SOFT_BREAKS) - break_type = MD_TEXT_BR; - else if(enforce_hardbreak) - break_type = MD_TEXT_BR; - else if((CH(line->end) == _T(' ') && CH(line->end+1) == _T(' '))) + if(enforce_hardbreak || (ctx->parser.flags & MD_FLAG_HARD_SOFT_BREAKS)) { break_type = MD_TEXT_BR; + } else { + while(off < ctx->size && ISBLANK(off)) + off++; + if(off >= line->end + 2 && CH(off-2) == _T(' ') && CH(off-1) == _T(' ') && ISNEWLINE(off)) + break_type = MD_TEXT_BR; + } } MD_TEXT(break_type, _T("\n"), 1); diff --git a/test/regressions.txt b/test/regressions.txt index 836b970a..70c2d167 100644 --- a/test/regressions.txt +++ b/test/regressions.txt @@ -761,3 +761,27 @@ baz*→
foo +bar
+```````````````````````````````` + +Tab + space + space + newline is hard break: +```````````````````````````````` example [no-normalize] +foo→ +bar +. +foo
+bar