bent10 / marked-extensions

Marked extensions workspace
https://www.npmjs.com/search?q=keywords:stilearning-marked-extensions
MIT License
32 stars 5 forks source link

The Markdown link seems to be preventing the footnotes generation. #23

Closed krymtkts closed 10 months ago

krymtkts commented 10 months ago

Description

The Markdown link seems to be preventing the footnotes generation.

Specifically, [ causes a bug.

To Reproduce (⚠️ read below)

https://replit.com/@krymtkts/marked-footnote-repro#index.html

<!doctype html>
<html lang="en">
  <body class="markdown-body">
    <div id="content"></div>

    <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/marked-footnote/dist/index.umd.min.js"></script>
    <script>
      const md = `# Example

[^1]: works fine.

[^2]: not work with [link](https://github.com/bent10/marked-extensions/tree/main/packages/footnote).

it works fine[^1]. not work with link[^2].
`

      document.getElementById("content").innerHTML = new marked.Marked()
        .use(markedFootnote())
        .parse(md)
    </script>
  </body>
</html>

Expected Behavior

Footnotes are not generated.

Actual Behavior

Footnotes are generated.

Additional Information

bent10 commented 10 months ago

Thanks for reporting this issue!

I've released marked-footnote@1.1.3 that fixed this issue. Feel free to explore and let me know if you have any feedback.

krymtkts commented 10 months ago

It works as expected. Thanks!