summaryrefslogtreecommitdiff
path: root/src/xml.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xml.c')
-rw-r--r--src/xml.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/xml.c b/src/xml.c
index 6956efb..b630810 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -52,10 +52,13 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
literal = false;
switch (node->type) {
+ case CMARK_NODE_DOCUMENT:
+ cmark_strbuf_puts(xml, " xmlns=\"http://commonmark.org/xml/1.0\"");
+ break;
case CMARK_NODE_TEXT:
case CMARK_NODE_CODE:
- case CMARK_NODE_HTML:
- case CMARK_NODE_INLINE_HTML:
+ case CMARK_NODE_HTML_BLOCK:
+ case CMARK_NODE_HTML_INLINE:
cmark_strbuf_puts(xml, ">");
escape_xml(xml, node->as.literal.data, node->as.literal.len);
cmark_strbuf_puts(xml, "</");
@@ -86,8 +89,8 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
(cmark_node_get_list_tight(node) ? "true" : "false"));
cmark_strbuf_puts(xml, buffer);
break;
- case CMARK_NODE_HEADER:
- snprintf(buffer, BUFFER_SIZE, " level=\"%d\"", node->as.header.level);
+ case CMARK_NODE_HEADING:
+ snprintf(buffer, BUFFER_SIZE, " level=\"%d\"", node->as.heading.level);
cmark_strbuf_puts(xml, buffer);
break;
case CMARK_NODE_CODE_BLOCK:
@@ -102,6 +105,17 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
cmark_strbuf_puts(xml, cmark_node_get_type_string(node));
literal = true;
break;
+ case CMARK_NODE_CUSTOM_BLOCK:
+ case CMARK_NODE_CUSTOM_INLINE:
+ cmark_strbuf_puts(xml, " on_enter=\"");
+ escape_xml(xml, node->as.custom.on_enter.data,
+ node->as.custom.on_enter.len);
+ cmark_strbuf_putc(xml, '"');
+ cmark_strbuf_puts(xml, " on_exit=\"");
+ escape_xml(xml, node->as.custom.on_exit.data,
+ node->as.custom.on_exit.len);
+ cmark_strbuf_putc(xml, '"');
+ break;
case CMARK_NODE_LINK:
case CMARK_NODE_IMAGE:
cmark_strbuf_puts(xml, " destination=\"");