Skip to content

Commit

Permalink
🐛 FIX: Parsing when newline is between footnote ID and first paragraph
Browse files Browse the repository at this point in the history
  • Loading branch information
hukkin committed Aug 8, 2022
1 parent d627eac commit 22d07e5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mdit_py_plugins/footnote/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def footnote_def(state: StateBlock, startLine: int, endLine: int, silent: bool):
if pos == start + 2: # no empty footnote labels
return False
pos += 1
if pos + 1 >= maximum or state.srcCharCode[pos] != 0x3A: # /* : */
if pos >= maximum or state.srcCharCode[pos] != 0x3A: # /* : */
return False
if silent:
return True
Expand Down
18 changes: 18 additions & 0 deletions tests/fixtures/footnote.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,21 @@ Some text
</ol>
</section>
.


Newline after footnote identifier
.
[^a]

[^a]:
b
.
<p><sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup></p>
<p>b</p>
<hr class="footnotes-sep">
<section class="footnotes">
<ol class="footnotes-list">
<li id="fn1" class="footnote-item"> <a href="#fnref1" class="footnote-backref"><-</a></li>
</ol>
</section>
.

0 comments on commit 22d07e5

Please sign in to comment.