vsch / flexmark-java

CommonMark/Markdown Java parser with source level AST. CommonMark 0.28, emulation of: pegdown, kramdown, markdown.pl, MultiMarkdown. With HTML to MD, MD to PDF, MD to DOCX conversion modules.
BSD 2-Clause "Simplified" License
2.26k stars 269 forks source link

Footnotes have a child P tag #564

Open Martmists-GH opened 1 year ago

Martmists-GH commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

When generating the footnotes, it wraps the content in a p tag, which looks wrong: Screenshot_20230401_233635 (top: desired, bottom: current)

To Reproduce

If you can please provide sample code which exhibits the issue. This is always best because it incorporates a testable morsel which includes all relevant information.

some text here with a footnote[^1] and some more text with a second footnote[^2]

[^1]: abc
[^2]: def

Expected behavior

<ol>
  <li id="fn-1">
    abc<a href="#fnref-1" class="footnote-backref">↩</a>
  </li>
  <li id="fn-2">
    def<a href="#fnref-2" class="footnote-backref">↩</a>
  </li>
</ol>

Resulting Output

<ol>
  <li id="fn-1">
    <p>abc</p>
    <a href="#fnref-1" class="footnote-backref">↩</a>
  </li>
  <li id="fn-2">
    <p>def</p>
    <a href="#fnref-2" class="footnote-backref">↩</a>
  </li>
</ol>