Repository navigation
Don't add an empty footnotes block when no footnote is referenced - #758
RavSinghChandan wants to merge 4 commits into
Conversation
|
New test missing the html file |
|
Thanks, added |
|
@Crozzers Can you think of any reason we'd want to keep a footnote that isn't used anywhere in the text body? On one hand it's not needed, on another hand if the user inputs a footnote then they might have some reason |
|
One detail that may help: this PR doesn't change whether an unused footnote is kept, master already leaves it out. For example, with The only difference is when no footnote is referenced: master still writes If you'd rather keep unused footnotes, that would be a separate change to how the list is built, and I'm happy to do it. |
|
Explanation makes sense. Can't think of a reason to keep other than if it does draw a stray |
With the
footnotesextra, a footnote that is defined but never referenced still makes markdown2 append the footnotes block, with an empty list:_add_footnoteschecksself.footnotes(the definitions) but only listsself.footnote_ids(the referenced ones), so the block is empty when nothing is referenced. It now checks the referenced ids, so the output is just<p>Text.</p>. Documents with referenced footnotes are unchanged, and unreferenced definitions were already left out of the list.Added the
footnotes_unreferencedtest case