kjdev / hoextdown

Hoextdown is an extension to Hoedown
MIT License
23 stars 15 forks source link

Subtle bugs due to differences between footnotes and regular text #55

Open Sjlver opened 6 years ago

Sjlver commented 6 years ago

Hoedown parses footnotes and regular document content differently:

This means that regular text has certain nice properties: tabs are expanded to spaces, lines are guaranteed to end in \n, and there is a newline at the end of the document. There are several locations in Hoedown's code that implicitly depend on these assumptions. However, the code at these locations is also used when parsing footnotes, where these assumptions do not hold.

To fix this problem, one would need to change how Hoedown processes the document:

  1. Normalize the input text (expand tabs, ensure \n at the right places)
  2. Split the input into footnotes and regular text
  3. Do the parsing.