cmark

Unnamed repository; edit this file 'description' to name the repository.

commit 029ced080c5fd483db72bba5082a16faeb8f8b75
parent 9a1b342685243c31d986248b12d96e4cb9db589d
Author: John MacFarlane <jgm@berkeley.edu>
Date:   Sun, 29 Mar 2015 16:00:56 -0700

commonmark renderer - two blank lines after list before code/list.

Diffstat:
Msrc/commonmark.c | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/commonmark.c b/src/commonmark.c
@@ -39,6 +39,13 @@ static inline void blankline(struct render_state *state)
 	}
 }
 
+static inline void double_blankline(struct render_state *state)
+{
+	if (state->need_cr < 3) {
+		state->need_cr = 3;
+	}
+}
+
 typedef enum  {
 	LITERAL,
 	NORMAL,
@@ -245,6 +252,12 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
 		break;
 
 	case CMARK_NODE_LIST:
+		if (!entering && node->next &&
+		    (node->next->type == CMARK_NODE_CODE_BLOCK ||
+		     node->next->type == CMARK_NODE_LIST)) {
+			// two blank lines after list before code block or list
+			double_blankline(state);
+		}
 		break;
 
 	case CMARK_NODE_ITEM: