summaryrefslogtreecommitdiff
path: root/src/node.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2014-11-20 15:17:33 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2014-11-22 16:08:32 +0100
commit32be14c39f67eedf356adc4f673b66479b717c7c (patch)
treefa33fca26fb0ef02a708fc9cca89acf85cb183dc /src/node.c
parent759e03748a368be8b209dfd113441c05e1a5dcc0 (diff)
Set defaults for new headers and lists
Diffstat (limited to 'src/node.c')
-rw-r--r--src/node.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/node.c b/src/node.c
index 4317dd4..bb9cacc 100644
--- a/src/node.c
+++ b/src/node.c
@@ -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;
}