Commit c2eca50a1c844d6fa6b940b5ab917dcfe5bcce39

Martin Mitas 2016-10-05T11:33:25

'\\' at the end of block does not cause hard break.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/md4c/md4c.c b/md4c/md4c.c
index 0d0e8eb..78d9143 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -379,7 +379,9 @@ md_analyze_inlines(MD_CTX* ctx, const MD_LINE* lines, int n_lines)
              * Note it can go beyond line->end as it may involve
              * escaped new line to form a hard break. */
             if(ch == _T('\\')  &&  off+1 < ctx->size  &&  (ISPUNCT(off+1) || ISNEWLINE(off+1))) {
-                PUSH(ch, off, off+2, MD_MARK_ACTIVE);
+                /* Hard-break cannot be on the last line of the block. */
+                if(!ISNEWLINE(off+1)  ||  i+1 < n_lines)
+                    PUSH(ch, off, off+2, MD_MARK_ACTIVE);
                 off += 2;
                 continue;
             }