summaryrefslogtreecommitdiff
path: root/src/commonmark.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/commonmark.c')
-rw-r--r--src/commonmark.c54
1 files changed, 17 insertions, 37 deletions
diff --git a/src/commonmark.c b/src/commonmark.c
index f00d243..7438920 100644
--- a/src/commonmark.c
+++ b/src/commonmark.c
@@ -215,8 +215,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
break;
case CMARK_NODE_LIST:
- if (!entering && node->next && (node->next->type == CMARK_NODE_CODE_BLOCK ||
- node->next->type == CMARK_NODE_LIST)) {
+ if (!entering && node->next && (node->next->type == CMARK_NODE_LIST)) {
// this ensures that a following indented code block or list will be
// inteprereted correctly.
CR();
@@ -277,14 +276,6 @@ 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;
@@ -297,34 +288,23 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
fencechar[0] = strchr(info, '`') == NULL ? '`' : '~';
code = cmark_node_get_literal(node);
code_len = strlen(code);
- // 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_len == 0 && (code_len > 2 && !cmark_isspace(code[0]) &&
- !(cmark_isspace(code[code_len - 1]) &&
- cmark_isspace(code[code_len - 2]))) &&
- !first_in_list_item) {
- LIT(" ");
- cmark_strbuf_puts(renderer->prefix, " ");
- OUT(cmark_node_get_literal(node), false, LITERAL);
- cmark_strbuf_truncate(renderer->prefix, renderer->prefix->size - 4);
- } else {
- numticks = longest_backtick_sequence(code) + 1;
- if (numticks < 3) {
- numticks = 3;
- }
- for (i = 0; i < numticks; i++) {
- LIT(fencechar);
- }
- LIT(" ");
- OUT(info, false, LITERAL);
- CR();
- OUT(cmark_node_get_literal(node), false, LITERAL);
- CR();
- for (i = 0; i < numticks; i++) {
- LIT(fencechar);
- }
+
+ numticks = longest_backtick_sequence(code) + 1;
+ if (numticks < 3) {
+ numticks = 3;
+ }
+ for (i = 0; i < numticks; i++) {
+ LIT(fencechar);
}
+ LIT(" ");
+ OUT(info, false, LITERAL);
+ CR();
+ OUT(cmark_node_get_literal(node), false, LITERAL);
+ CR();
+ for (i = 0; i < numticks; i++) {
+ LIT(fencechar);
+ }
+
BLANKLINE();
break;