summaryrefslogtreecommitdiff
path: root/src/html.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-12-19 15:26:18 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-12-19 15:26:18 -0800
commit00ae2c61a47e09bb7643f0a7153c2009b7537e09 (patch)
treeb5d07e1ad0d9950012951b6c69013a63722ff192 /src/html.c
parent70545251f4d1685a600e8eeb7b78eea430613b94 (diff)
Added RAW_BLOCK and RAW_INLINE node types.
These are passed through verbatim by all writers, with no escaping. They are never generated by the parser, and do not correspond to CommonMark elements. They are designed to be inserted by filters that postprocess the AST. For example, a filter might convert specially marked code blocks to svg diagrams in HTML and tikz diagrams in LaTeX, passing these through to the renderer as a RAW_BLOCK.
Diffstat (limited to 'src/html.c')
-rw-r--r--src/html.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/html.c b/src/html.c
index dfe2aec..4fa4437 100644
--- a/src/html.c
+++ b/src/html.c
@@ -176,6 +176,12 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
cr(html);
break;
+ case CMARK_NODE_RAW_BLOCK:
+ cr(html);
+ cmark_strbuf_put(html, node->as.literal.data, node->as.literal.len);
+ cr(html);
+ break;
+
case CMARK_NODE_HRULE:
cr(html);
cmark_strbuf_puts(html, "<hr");
@@ -233,6 +239,10 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
}
break;
+ case CMARK_NODE_RAW_INLINE:
+ cmark_strbuf_put(html, node->as.literal.data, node->as.literal.len);
+ break;
+
case CMARK_NODE_STRONG:
if (entering) {
cmark_strbuf_puts(html, "<strong>");