-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Talking with @tarleb earlier today, I realized we forgot to handle footnotes in the OXA document schema.
I think we need to be a little careful to not replicate what I consider to be a design mistake in Pandoc's handling of footnotes. Pandoc has no notion of footnote definitions vs references; the Markdown parser "merges" the footnote definition into the reference as part of the parsing, and this has a number of unfortunate consequences. Here's two:
source location becomes hard to track in a coarse manner
Consider this document:
This is a footnote[^1]. And some more text.
Some other stuff:
[^1]: You have to watch out for footnote locations
If you want to write tooling that can use source location information, there's no way to link line 1 to line 5 without a lot of additional work.
Programmatic AST manipulation of content with footnotes is very fraught
This is a much more serious problem. In Quarto, we often need to copy document snippets (for example, creating a navigational sidebar of all header elements). If there are footnotes in the header elements, they will be duplicated, and it's sort of fundamentally impossible to do the job correctly. We can't in principle look at Pandoc's AST and determine how to "uniquify" footnotes.
In quarto-markdown, we've taken the drastic step of creating explicit nodes for footnote definitions and references.
As I type this, I realize...
We already have infrastructure in OXA documents for internal referenceable elements, both for references and their definitions: they are panels.
I now think we should simply say that footnotes are a BlockPanel of kind: "footnote", and use the citation infrastructure for resolving them.