cmark

My personal build of CMark ✏️

Commit
a1d74c440b79d13047091b6c10cc0188f758d3ff
Parent
555dd2da77914d6120b55b64908c59053d1596ec
Author
John MacFarlane <jgm@berkeley.edu>
Date

Fixed bug in html renderer for custom nodes.

Diffstat

1 file changed, 14 insertions, 8 deletions

Status File Name N° Changes Insertions Deletions
Modified src/html.c 22 14 8
diff --git a/src/html.c b/src/html.c
@@ -178,10 +178,13 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
 
   case CMARK_NODE_CUSTOM_BLOCK:
     cr(html);
-    cmark_strbuf_put(
-        html, (const unsigned char *)(entering ? cmark_node_get_on_enter(node)
-                                               : cmark_node_get_on_exit(node)),
-        node->as.literal.len);
+    if (entering) {
+      cmark_strbuf_put(html, node->as.custom.on_enter.data,
+                       node->as.custom.on_enter.len);
+    } else {
+      cmark_strbuf_put(html, node->as.custom.on_exit.data,
+                       node->as.custom.on_exit.len);
+    }
     cr(html);
     break;
 
@@ -243,10 +246,13 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
     break;
 
   case CMARK_NODE_CUSTOM_INLINE:
-    cmark_strbuf_put(
-        html, (const unsigned char *)(entering ? cmark_node_get_on_enter(node)
-                                               : cmark_node_get_on_exit(node)),
-        node->as.literal.len);
+    if (entering) {
+      cmark_strbuf_put(html, node->as.custom.on_enter.data,
+                       node->as.custom.on_enter.len);
+    } else {
+      cmark_strbuf_put(html, node->as.custom.on_exit.data,
+                       node->as.custom.on_exit.len);
+    }
     break;
 
   case CMARK_NODE_STRONG: