From 77f7e7ae8b8f6c42c12e658c7a129429c1ba7bee Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 21 Dec 2019 09:36:08 -0800 Subject: 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. --- src/commonmark.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/commonmark.c') 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(""); + BLANKLINE(); + } + first_in_list_item = node->prev == NULL && node->parent && node->parent->type == CMARK_NODE_ITEM; -- cgit v1.2.3