Closed zakkor closed 11 months ago
Parsing markdown with footnotes output is non-idempotent, see reproduction for example.
To Reproduce (⚠️ read below)
const str = `Here's a simple footnote,[^1] thanks. [^1]: This is the first footnote.`; let rendered = marked.parse(str); console.log(`rendered:`, rendered); // Output: <p>Here's a simple footnote,<sup><a id=\"footnote-ref-1\" href=\"#footnote-1\" data-footnote-ref aria-describedby=\"footnote-label\">[1]</a></sup> thanks.</p> <section class=\"footnotes\" data-footnotes> <h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2> <ol> <li id=\"footnote-1\"> <p>This is the first footnote. <a href=\"#footnote-ref-1\" data-footnote-backref aria-label=\"Back to reference 1\">↩</a></p> </li> </ol> </section> rendered = marked.parse(str); console.log(`rendered:`, rendered); // Output: <p>Here's a simple footnote,<sup><a id=\"footnote-ref-1\" href=\"#footnote-1\" data-footnote-ref aria-describedby=\"footnote-label\">[2]</a></sup> thanks.</p> <section class=\"footnotes\" data-footnotes> <h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2> <ol> <li id=\"footnote-1\"> <p>This is the first footnote. <a href=\"#footnote-ref-1\" data-footnote-backref aria-label=\"Back to reference 1\">↩</a></p> </li> </ol> </section>
The second time the same string is parsed, the superscript is now [2], instead of [1], even though the other reference IDs correctly have it as [1].
Superscript is [2]
The issue has been resolved in v1.2.1. Thanks for reporting it!
Description
Parsing markdown with footnotes output is non-idempotent, see reproduction for example.
To Reproduce (⚠️ read below)
Expected Behavior
The second time the same string is parsed, the superscript is now [2], instead of [1], even though the other reference IDs correctly have it as [1].
Actual Behavior
Superscript is [2]
Additional Information