diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-12-21 09:36:08 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-12-21 09:36:08 -0800 |
commit | 77f7e7ae8b8f6c42c12e658c7a129429c1ba7bee (patch) | |
tree | b9e9291e5edaff09976ee64f98afebff53b25f66 /src/commonmark.c | |
parent | 8a71de7d058592b05c7f74424d2a2efbeab8ddc2 (diff) |
Ensure that consecutive indented code blocks aren't merged...
by inserting an HTML comment. Closes #317.
I think I'll follow up with a change to use fenced code
blocks, but this was the minimal fix.
Diffstat (limited to 'src/commonmark.c')
-rw-r--r-- | src/commonmark.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/commonmark.c b/src/commonmark.c index 3440a91..f00d243 100644 --- a/src/commonmark.c +++ b/src/commonmark.c @@ -277,6 +277,15 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, break; case CMARK_NODE_CODE_BLOCK: + if (entering && node->prev && + (node->prev->type == CMARK_NODE_CODE_BLOCK)) { + // this ensures that consecutive indented code blocks will not + // be merged (#317) + CR(); + LIT("<!-- end code block -->"); + BLANKLINE(); + } + first_in_list_item = node->prev == NULL && node->parent && node->parent->type == CMARK_NODE_ITEM; |