diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2014-11-20 15:17:33 +0100 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2014-11-22 16:08:32 +0100 |
commit | 32be14c39f67eedf356adc4f673b66479b717c7c (patch) | |
tree | fa33fca26fb0ef02a708fc9cca89acf85cb183dc /src | |
parent | 759e03748a368be8b209dfd113441c05e1a5dcc0 (diff) |
Set defaults for new headers and lists
Diffstat (limited to 'src')
-rw-r--r-- | src/node.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -11,6 +11,25 @@ cmark_node* cmark_node_new(cmark_node_type type) { cmark_node *node = (cmark_node *)calloc(1, sizeof(*node)); node->type = type; + + switch (node->type) { + case CMARK_NODE_ATX_HEADER: + case CMARK_NODE_SETEXT_HEADER: + node->as.header.level = 1; + break; + + case CMARK_NODE_LIST: { + cmark_list *list = &node->as.list; + list->list_type = CMARK_BULLET_LIST; + list->start = 1; + list->tight = false; + break; + } + + default: + break; + } + return node; } |