cmark

My personal build of CMark ✏️

Commit
8c75cce5e755799c743699286403440d10b42bbd
Parent
54bc9903cff53399c4bc67be0d1b842201863f83
Author
John MacFarlane <jgm@berkeley.edu>
Date

commonmark renderer: use 4-space indent for bullet lists.

This makes the output compatible with more implementations.

Diffstat

1 file changed, 5 insertions, 6 deletions

Status File Name N° Changes Insertions Deletions
Modified src/commonmark.c 11 5 6
diff --git a/src/commonmark.c b/src/commonmark.c
@@ -201,7 +201,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
 
   case CMARK_NODE_ITEM:
     if (cmark_node_get_list_type(node->parent) == CMARK_BULLET_LIST) {
-      marker_width = 2;
+      marker_width = 4;
     } else {
       list_number = cmark_node_get_list_start(node->parent);
       list_delim = cmark_node_get_list_delim(node->parent);
@@ -220,15 +220,14 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
     }
     if (entering) {
       if (cmark_node_get_list_type(node->parent) == CMARK_BULLET_LIST) {
-        LIT("* ");
+        LIT("  - ");
         renderer->begin_content = true;
-        cmark_strbuf_puts(renderer->prefix, "  ");
       } else {
         LIT(listmarker);
         renderer->begin_content = true;
-        for (i = marker_width; i--;) {
-          cmark_strbuf_putc(renderer->prefix, ' ');
-        }
+      }
+      for (i = marker_width; i--;) {
+        cmark_strbuf_putc(renderer->prefix, ' ');
       }
     } else {
       cmark_strbuf_truncate(renderer->prefix,