cmark

My personal build of CMark ✏️

Commit
31423d6f7d2e1af5c22fdcc74b6e951f15a1130c
Parent
9409e2ee7ec7b1a4500a1e09e7ffb24b0eb29195
Author
John MacFarlane <jgm@berkeley.edu>
Date

Commonmark renderer: use HTML comment to separate list from

following list or code block.

This has several advantages. First, the two blank lines breaks out of list syntax is still controversial in CommonMark. And it isn't used in other implementations. HTML comments will always work.

Second, two blank lines breaks out of all lists; an HTML comment can be used to break out of just one level of nesting.

Diffstat

1 file changed, 5 insertions, 3 deletions

Status File Name N° Changes Insertions Deletions
Modified src/commonmark.c 8 5 3
diff --git a/src/commonmark.c b/src/commonmark.c
@@ -193,9 +193,11 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
   case CMARK_NODE_LIST:
     if (!entering && node->next && (node->next->type == CMARK_NODE_CODE_BLOCK ||
                                     node->next->type == CMARK_NODE_LIST)) {
-      // this ensures 2 blank lines after list,
-      // if before code block or list:
-      LIT("\n");
+      // this ensures that a following code block or list will be
+      // inteprereted correctly.
+      CR();
+      LIT("<!-- end list -->");
+      BLANKLINE();
     }
     break;