ext/commonmarker/cmark/src/render.c in commonmarker-0.5.1 vs ext/commonmarker/cmark/src/render.c in commonmarker-0.6.0
- old
+ new
@@ -42,10 +42,11 @@
renderer->prefix->size);
}
}
renderer->column = 0;
renderer->begin_line = true;
+ renderer->begin_content = true;
renderer->need_cr -= 1;
}
while (i < length) {
if (renderer->begin_line) {
@@ -63,10 +64,11 @@
if (c == 32 && wrap) {
if (!renderer->begin_line) {
cmark_strbuf_putc(renderer->buffer, ' ');
renderer->column += 1;
renderer->begin_line = false;
+ renderer->begin_content = false;
renderer->last_breakable = renderer->buffer->size - 1;
// skip following spaces
while (source[i + 1] == ' ') {
i++;
}
@@ -74,17 +76,20 @@
} else if (c == 10) {
cmark_strbuf_putc(renderer->buffer, '\n');
renderer->column = 0;
renderer->begin_line = true;
+ renderer->begin_content = true;
renderer->last_breakable = 0;
} else if (escape == LITERAL) {
cmark_render_code_point(renderer, c);
renderer->begin_line = false;
+ renderer->begin_content = false;
} else {
(renderer->outc)(renderer, escape, c, nextc);
renderer->begin_line = false;
+ renderer->begin_content = false;
}
// If adding the character went beyond width, look for an
// earlier place where the line could be broken:
if (renderer->width > 0 && renderer->column > renderer->width &&
@@ -102,10 +107,11 @@
cmark_strbuf_put(renderer->buffer, remainder.data, remainder.len);
renderer->column = renderer->prefix->size + remainder.len;
cmark_chunk_free(&remainder);
renderer->last_breakable = 0;
renderer->begin_line = false;
+ renderer->begin_content = false;
}
i += len;
}
}
@@ -134,10 +140,11 @@
cmark_event_type ev_type;
char *result;
cmark_iter *iter = cmark_iter_new(root);
cmark_renderer renderer = {&buf, &pref, 0, width, 0, 0, true,
- false, false, outc, S_cr, S_blankline, S_out};
+ false, false, false,
+ outc, S_cr, S_blankline, S_out};
while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) {
cur = cmark_iter_get_node(iter);
if (!render_node(&renderer, cur, ev_type, options)) {
// a false value causes us to skip processing