Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## python-markdown2 2.5.6 (not yet released)

- [pull #758] Fix `footnotes` extra adding an empty footnotes block when no footnote is referenced.
- [pull #746] Preserve query strings and fragments in `markdown-file-links` conversions, including reference-link targets.
- [pull #739] Fix `header-ids` extra putting sanitized HTML into header ids in safe mode, which allowed attribute injection (#649)
- [pull #732] Fix excessive CPU use in the inline HTML tokenizer on repeated unclosed tag fragments (#707)
Expand Down
3 changes: 2 additions & 1 deletion lib/markdown2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2280,7 +2280,8 @@ def _form_paragraphs(self, text: str) -> str:
return "\n\n".join(grafs)

def _add_footnotes(self, text: str) -> str:
if self.footnotes:
# Only referenced footnotes are listed, so there is nothing to add without any reference
if self.footnote_ids:
footer = [
'<div class="footnotes">',
'<hr' + self.empty_element_suffix,
Expand Down
1 change: 1 addition & 0 deletions test/tm-cases/footnotes_unreferenced.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"extras": ["footnotes"]}
3 changes: 3 additions & 0 deletions test/tm-cases/footnotes_unreferenced.text
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This paragraph has no footnote marker.

[^1]: A footnote that is never referenced.