diff options
Diffstat (limited to 'markdown/extensions/footnotes.py')
-rw-r--r-- | markdown/extensions/footnotes.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/markdown/extensions/footnotes.py b/markdown/extensions/footnotes.py index cdaf391..072c5dd 100644 --- a/markdown/extensions/footnotes.py +++ b/markdown/extensions/footnotes.py @@ -238,7 +238,12 @@ class FootnotePreprocessor(Preprocessor): fn, _i = self.detectTabbed(lines[i+1:]) fn.insert(0, m.group(2)) i += _i-1 # skip past footnote - self.footnotes.setFootnote(m.group(1), "\n".join(fn)) + footnote = "\n".join(fn) + self.footnotes.setFootnote(m.group(1), footnote.rstrip()) + # Preserve a line for each block to prevent raw HTML indexing issue. + # https://github.com/Python-Markdown/markdown/issues/584 + num_blocks = (len(footnote.split('\n\n')) * 2) + newlines.extend([''] * (num_blocks)) else: newlines.append(lines[i]) if len(lines) > i+1: @@ -290,6 +295,11 @@ class FootnotePreprocessor(Preprocessor): if lines[j].strip(): next_line = lines[j] break + else: + # Include extreaneous padding to prevent raw HTML + # parsing issue: https://github.com/Python-Markdown/markdown/issues/584 + items.append("") + i += 1 else: break # There is no more text; we are done. |