jupyter-book / mystmd

Command line tools for working with MyST Markdown.
https://mystmd.org/guide
MIT License
205 stars 61 forks source link

Parse footnote references even with no corresponding definition #278

Open fwkoch opened 1 year ago

fwkoch commented 1 year ago

A footnote reference without a corresponding footnote definition is just parsed as text:

image

Here, we add a footnote definition and the reference materializes in the AST:

image

This behavior comes from markdown-it-footnote - I'm pretty sure here, but I haven't dug super deep: https://github.com/markdown-it/markdown-it-footnote/blob/master/index.js#L256

Keeping footnote references in the in the AST would be nicer for keeping the document as structured data, error reporting for missing definitions, etc (and we could still render the content as plain text if we wanted).

Implementation here is a little dicey - do we move away from markdown-it-footnote...?

rowanc1 commented 1 year ago

This is related to and/or would fix:

We can always parse and then revert to text at a later stage as you note, but it is certainly helpful to have this parsed.