From 71af174519e2c5f54c69d8716c18c83ef27caa2d Mon Sep 17 00:00:00 2001 From: Sami A Date: Thu, 19 Sep 2013 15:26:46 -0500 Subject: [PATCH] Fix footnote parsing Consecutive footnotes do not need to be surrounded by blank lines, courtesy of @microjo. For example, this is now possible: [^1]: footnote1 [^2]: footnote2 --- src/markdown.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/markdown.c b/src/markdown.c index 5d6b350..11731d6 100644 --- a/src/markdown.c +++ b/src/markdown.c @@ -2459,13 +2459,6 @@ is_footnote(const uint8_t *data, size_t beg, size_t end, size_t *last, struct fo i++; if (i >= end || data[i] != ':') return 0; i++; - while (i < end && data[i] == ' ') i++; - if (i < end && (data[i] == '\n' || data[i] == '\r')) { - i++; - if (i < end && data[i] == '\n' && data[i - 1] == '\r') i++; - } - while (i < end && data[i] == ' ') i++; - if (i >= end || data[i] == '\n' || data[i] == '\r') return 0; /* getting content buffer */ contents = bufnew(64); @@ -2495,8 +2488,9 @@ is_footnote(const uint8_t *data, size_t beg, size_t end, size_t *last, struct fo /* joining only indented stuff after empty lines; * note that now we only require 1 space of indentation * to continue, just like lists */ - if (in_empty && ind == 0) { - break; + if (ind == 0) { + if (start == id_end + 2 && data[start] == '\t') {} + else break; } else if (in_empty) { bufputc(contents, '\n');