🍄Footnote Block

NB. This is just an idea. https://todo.sr.ht/~bouncepaw/mycomarkup/5

Look, GFM has got footnotes!

We actually have an idea of that, too. Let's implement it in similar fashion.

I like apples[[^about-apple]]. Let's bake charlotte pie[[^1]]!

notes {
  about-apple | { They are tasty.
But you need to be aware of worms. }
  1 | https://tasty-pies.org/charlotte.html


  • I've replaced & to ^, like in most of Markdown dialects.

  • Also I've replaced links to notes to not mistake the idea with 'link aliases'. Possible alternatives are 'foot', 'footnotes', 'footer' etc.


Technically, it should be a two-pass process (scan for links, enumerate, and only then render both links and anchors). But we can force top-to-bottom declaration syntax and link-based enumeration. And also allow duplicate links (however, we would also need to implement anchor joining then).

Also, it is possible to implement this with a visitor, which would collect notes blocks, enumerate and replace footnote links with anchors (like, name="footnote-1" href="#footer-about-apple") on-the-fly, and then we would use it to render a separate footnotes section. But seemingly inline mycolinks can't have names (thus, anchors to them), so we'd have to add them for return links.

Full Mycomarkup support in footnotes is seemingly possible, but I'd be careful with transclusions. Links and the section design is also a discussion point.

Possible problems

  • marking or hiding invalid/missing footnotes, if we stick to an one-pass algorithm, because HTML renderer doesn't take any context besides of recursion level and block counter.

  • hiding transclusion footlinks. But it seems that transclusions are rendered separately, so we could somehow invalidate these links with a special visitor.