diff options
author | John MacFarlane <jgm@berkeley.edu> | 2016-01-17 13:25:21 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-01-17 13:28:07 -0800 |
commit | 31423d6f7d2e1af5c22fdcc74b6e951f15a1130c (patch) | |
tree | e4ca7efbc034ef7e6204921c5c1c6d3138e0f485 | |
parent | 9409e2ee7ec7b1a4500a1e09e7ffb24b0eb29195 (diff) |
Commonmark renderer: use HTML comment to separate list from
following list or code block.
This has several advantages. First, the two blank lines breaks
out of list syntax is still controversial in CommonMark.
And it isn't used in other implementations. HTML comments
will always work.
Second, two blank lines breaks out of all lists; an HTML
comment can be used to break out of just one level of nesting.
-rw-r--r-- | src/commonmark.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/commonmark.c b/src/commonmark.c index 55ca037..3eac076 100644 --- a/src/commonmark.c +++ b/src/commonmark.c @@ -193,9 +193,11 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, case CMARK_NODE_LIST: if (!entering && node->next && (node->next->type == CMARK_NODE_CODE_BLOCK || node->next->type == CMARK_NODE_LIST)) { - // this ensures 2 blank lines after list, - // if before code block or list: - LIT("\n"); + // this ensures that a following code block or list will be + // inteprereted correctly. + CR(); + LIT("<!-- end list -->"); + BLANKLINE(); } break; |