diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-03-29 16:00:56 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-03-29 16:00:56 -0700 |
commit | 029ced080c5fd483db72bba5082a16faeb8f8b75 (patch) | |
tree | 1a8cbf889f605d361a332e9a14dc3fd139f29c36 /src/commonmark.c | |
parent | 9a1b342685243c31d986248b12d96e4cb9db589d (diff) |
commonmark renderer - two blank lines after list before code/list.
Diffstat (limited to 'src/commonmark.c')
-rw-r--r-- | src/commonmark.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/commonmark.c b/src/commonmark.c index 7aa9326..4edf1b2 100644 --- 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: |