Commit 93701fdbe3bfde82a83b9d27c08b78666b18ac44

Martin Mitas 2016-12-01T11:51:57

md_process_inlines: Handle line breaks inside (inline) raw HTML.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/md4c/md4c.c b/md4c/md4c.c
index 09b531a..0665c20 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -3501,6 +3501,16 @@ md_process_inlines(MD_CTX* ctx, const MD_LINE* lines, int n_lines)
 
                 if(prev_mark->end < off  &&  off < mark->beg)
                     MD_TEXT(MD_TEXT_CODE, _T(" "), 1);
+            } else if(text_type == MD_TEXT_HTML) {
+                /* Inside raw HTML, we output the new line verbatim, including
+                 * any trailing spaces. */
+                OFF tmp = off;
+
+                while(tmp < end  &&  ISBLANK(tmp))
+                    tmp++;
+                if(tmp > off)
+                    MD_TEXT(MD_TEXT_HTML, STR(off), tmp - off);
+                MD_TEXT(MD_TEXT_HTML, _T("\n"), 1);
             } else {
                 /* Output soft or hard line break. */
                 MD_TEXTTYPE break_type = MD_TEXT_SOFTBR;