From 1fad45bf96b3daf2fcba747d44caa4556c68917a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 29 Mar 2015 17:57:19 -0700 Subject: commonmark - don't use indented code if first thing in list item. --- src/commonmark.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/commonmark.c b/src/commonmark.c index 61eb4cc..96f4c3a 100644 --- a/src/commonmark.c +++ b/src/commonmark.c @@ -342,13 +342,16 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, blankline(state); info = cmark_node_get_fence_info(node); code = &node->as.code.literal; + // use indented form if no info, and code doesn't + // begin or end with a blank line, and code isn't + // first thing in a list item if ((info == NULL || strlen(info) == 0) && (code->len > 2 && !isspace(code->data[0]) && !(isspace(code->data[code->len - 1]) && - isspace(code->data[code->len - 2])))) { - // use indented form if no info and code doesn't - // begin or end with a blank line + isspace(code->data[code->len - 2]))) && + !(node->prev == NULL && node->parent && + node->parent->type == CMARK_NODE_ITEM)) { lit(state, " ", false); cmark_strbuf_puts(state->prefix, " "); out(state, node->as.code.literal, false, LITERAL); -- cgit v1.2.3