ext/redcarpet/markdown.c in redcarpet-3.2.2 vs ext/redcarpet/markdown.c in redcarpet-3.2.3
- old
+ new
@@ -459,11 +459,11 @@
/* parse_inline • parses inline markdown elements */
static void
parse_inline(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t size)
{
- size_t i = 0, end = 0;
+ size_t i = 0, end = 0, consumed = 0;
uint8_t action = 0;
struct buf work = { 0, 0, 0, 0 };
if (rndr->work_bufs[BUFFER_SPAN].size +
rndr->work_bufs[BUFFER_BLOCK].size > rndr->max_nesting)
@@ -484,15 +484,16 @@
bufput(ob, data + i, end - i);
if (end >= size) break;
i = end;
- end = markdown_char_ptrs[(int)action](ob, rndr, data + i, i, size - i);
+ end = markdown_char_ptrs[(int)action](ob, rndr, data + i, i - consumed, size - i);
if (!end) /* no action from the callback */
end = i + 1;
else {
i += end;
end = i;
+ consumed = i;
}
}
}
/* find_emph_char • looks for the next emph uint8_t, skipping other constructs */