diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-03-29 17:57:19 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-03-29 17:57:19 -0700 |
commit | 1fad45bf96b3daf2fcba747d44caa4556c68917a (patch) | |
tree | 64235ec33f2ce1cb6270f7515938a2c4cc88c5ae /src | |
parent | df29746dabf154ce09f3bfbdeeafb62bff72366a (diff) |
commonmark - don't use indented code if first thing in list item.
Diffstat (limited to 'src')
-rw-r--r-- | src/commonmark.c | 9 |
1 files 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); |