RobertDober / earmark_parser

The Markdown to AST part of Earmark.
Apache License 2.0
68 stars 26 forks source link

Footnotes don't work when embedded in a list #40

Closed michaelforrest closed 3 years ago

michaelforrest commented 3 years ago

This code (parsed with footnotes: true, of course):

* here is a footnote in a list[^1]

[^1]: my footnote from the list

Results in the following AST:

{"ul", [], [{"li", [], ["here is a footnote in a list[^1]"], %{}}], %{}}

It's swallowing the footnote content and not creating a link in the list item.

I thought I'd try to be helpful by starting a PR on this but not sure it's useful without a solution! It's gonna be regex hell isn't it...

RobertDober commented 3 years ago

Thank you for reporting this and sorry for the late reply.

I'll have a look at this asap

RobertDober commented 3 years ago

I struggle with the complicated task to make lists much more GFM compliant for a long time :blush: I will keep this open as it's definitely a bug but have no schedule for a fix. Sorry about that

michaelforrest commented 3 years ago

"High hanging fruit" lol.

It's fine, for now I'm just putting my footnotes outside my lists!

RobertDober commented 3 years ago

Unfortunately it is high hanging fruit for me and a warning to potential PR authors.

Nevertheless I will try to fix it, eventually, whenever that may be.

michaelforrest commented 3 years ago

No no, I just meant that I like the term "high hanging fruit" - I hadn't seen it before! :-)

Totally understand the usage!

RobertDober commented 3 years ago

Oh good, I was afraid you thought it was easy to fix; Glad you like the label

michaelforrest commented 3 years ago

Sorry about that! Thanks for the library, it's really useful. (basically powers all my content on this site: https://squares.tv)

RobertDober commented 3 years ago

No need to apologize you are right to see the world with a smile, sometimes written communication is brittle. Happy EarmarkParser serves you, sorry for the bad list support (that's why I am so defensive)

michaelforrest commented 3 years ago

Nice one! 👍👍

RobertDober commented 3 years ago

appreciated @michaelforrest