cmark

My personal build of CMark ✏️

Commit
77f7e7ae8b8f6c42c12e658c7a129429c1ba7bee
Parent
8a71de7d058592b05c7f74424d2a2efbeab8ddc2
Author
John MacFarlane <jgm@berkeley.edu>
Date

Ensure that consecutive indented code blocks aren't merged...

by inserting an HTML comment. Closes #317. I think I'll follow up with a change to use fenced code blocks, but this was the minimal fix.

Diffstat

1 file changed, 9 insertions, 0 deletions

Status File Name N° Changes Insertions Deletions
Modified src/commonmark.c 9 9 0
diff --git a/src/commonmark.c b/src/commonmark.c
@@ -277,6 +277,15 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
     break;
 
   case CMARK_NODE_CODE_BLOCK:
+    if (entering && node->prev &&
+		    (node->prev->type == CMARK_NODE_CODE_BLOCK)) {
+      // this ensures that consecutive indented code blocks will not
+      // be merged (#317)
+      CR();
+      LIT("<!-- end code block -->");
+      BLANKLINE();
+    }
+
     first_in_list_item = node->prev == NULL && node->parent &&
                          node->parent->type == CMARK_NODE_ITEM;