commit 45a1027115059210658b39b1c8b1403f95ad96aa parent 2928484250d8834340691868b618951f0bea1b37 Author: Martin Mitas <mity@morous.org> Date: Wed, 7 Dec 2016 13:43:54 +0100 md_do_normalize_string: Fix handling of escaped backslash ("\\"). Diffstat:
| M | md4c/md4c.c | | | 13 | +++++++------ |
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/md4c/md4c.c b/md4c/md4c.c @@ -867,14 +867,15 @@ md_do_normalize_string(MD_CTX* ctx, OFF beg, OFF end, const MD_LINE* lines, int } if(resolve_escapes && CH(off) == _T('\\') && - off+1 < end && (ISPUNCT(off+1) || ISNEWLINE(off+1))) - { - off++; - } else { - *ptr = CH(off); - ptr++; + off+1 < end && (ISPUNCT(off+1) || ISNEWLINE(off+1))) { + if(ISNEWLINE(off+1)) + break; off++; } + + *ptr = CH(off); + ptr++; + off++; } *ptr = line_break_replacement_char;