diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/blocks.c | 3 | ||||
-rw-r--r-- | src/cmark.h | 4 | ||||
-rw-r--r-- | src/html.c | 3 | ||||
-rw-r--r-- | src/node.c | 2 | ||||
-rw-r--r-- | src/print.c | 4 |
5 files changed, 13 insertions, 3 deletions
diff --git a/src/blocks.c b/src/blocks.c index 8ca10b9..ebef88b 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -201,8 +201,7 @@ static void finalize(cmark_parser *parser, cmark_node* b, int line_number) strbuf_drop(&b->string_content, pos); } if (is_blank(&b->string_content, 0)) { - // remove blank node (former reference def) - cmark_node_free(b); + b->type = NODE_REFERENCE_DEF; } break; diff --git a/src/cmark.h b/src/cmark.h index 224ef3a..3eab93a 100644 --- a/src/cmark.h +++ b/src/cmark.h @@ -47,9 +47,10 @@ typedef enum { CMARK_NODE_PARAGRAPH, CMARK_NODE_HEADER, CMARK_NODE_HRULE, + CMARK_NODE_REFERENCE_DEF, CMARK_NODE_FIRST_BLOCK = CMARK_NODE_DOCUMENT, - CMARK_NODE_LAST_BLOCK = CMARK_NODE_HRULE, + CMARK_NODE_LAST_BLOCK = CMARK_NODE_REFERENCE_DEF, /* Inline */ CMARK_NODE_TEXT, @@ -336,6 +337,7 @@ int cmark_walk(cmark_node *root, cmark_node_handler handler, void *state); #define NODE_PARAGRAPH CMARK_NODE_PARAGRAPH #define NODE_HEADER CMARK_NODE_HEADER #define NODE_HRULE CMARK_NODE_HRULE + #define NODE_REFERENCE_DEF CMARK_NODE_REFERENCE_DEF #define NODE_TEXT CMARK_NODE_TEXT #define NODE_SOFTBREAK CMARK_NODE_SOFTBREAK #define NODE_LINEBREAK CMARK_NODE_LINEBREAK @@ -163,6 +163,9 @@ S_render_node(cmark_node *node, int entering, void *vstate) strbuf_puts(html, "<hr />\n"); break; + case CMARK_NODE_REFERENCE_DEF: + break; + case CMARK_NODE_PARAGRAPH: parent = cmark_node_parent(node); grandparent = cmark_node_parent(parent); @@ -102,6 +102,7 @@ S_type_string(cmark_node *node) case CMARK_NODE_PARAGRAPH: return "PARAGRAPH"; case CMARK_NODE_HEADER: return "HEADER"; case CMARK_NODE_HRULE: return "HRULE"; + case CMARK_NODE_REFERENCE_DEF: return "REFERENCE_DEF"; case CMARK_NODE_TEXT: return "TEXT"; case CMARK_NODE_SOFTBREAK: return "SOFTBREAK"; case CMARK_NODE_LINEBREAK: return "LINEBREAK"; @@ -773,6 +774,7 @@ int S_is_leaf_node(cmark_node *current_node) case CMARK_NODE_HTML: case CMARK_NODE_HRULE: case CMARK_NODE_CODE_BLOCK: + case CMARK_NODE_REFERENCE_DEF: case CMARK_NODE_TEXT: case CMARK_NODE_SOFTBREAK: case CMARK_NODE_LINEBREAK: diff --git a/src/print.c b/src/print.c index 9384a0b..d2dfe8c 100644 --- a/src/print.c +++ b/src/print.c @@ -88,6 +88,10 @@ static void render_nodes(strbuf* buffer, cmark_node* node, int indent) print_str(buffer, node->string_content.ptr, -1); strbuf_putc(buffer, '\n'); break; + case NODE_REFERENCE_DEF: + // skip + // strbuf_printf(buffer, "reference_def\n"); + break; case NODE_TEXT: strbuf_printf(buffer, "text "); print_str(buffer, node->as.literal.data, node->as.literal.len); |