Commit 24ac7eadd8d6168456f297a0775bfddb0dea37db

Martin Mitas 2016-10-08T20:55:53

Fix parsing of ATX headers. If indented, it cannot be ATX header.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/md4c/md4c.c b/md4c/md4c.c
index 1abecae..c601964 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -1564,8 +1564,9 @@ redo_indentation_after_blockquote_mark:
         goto done;
     }
 
-    /* Check whether we are ATX header. */
-    if(CH(off) == _T('#')) {
+    /* Check whether we are ATX header.
+     * (We check the indentation to fix http://spec.commonmark.org/0.26/#example-40) */
+    if(line->indent < 4  &&  CH(off) == _T('#')) {
         if(md_is_atxheader_line(ctx, off, &line->beg, &off) == 0) {
             line->type = MD_LINE_ATXHEADER;
             goto done;