Footnote extensions vs Link Reference Definition

Babelmark 3 currently interfaces with “GitHub Flavored Markdown”, i.e. cmark-gfm, version 0.17.4, which does not seem to have this extension enabled yet.

GitHub’s documentation extensions.txt should probably be written more like spec.txt. It is missing several edge cases right now.

Anyway, I did not really get the point of this thread. No other implementation seems to support Pandoc’s inline footnotes with a circumflex preceding bracketed text, ^[footnote], and automatically generated mark. MMD will turn the link label [^footnote] into inline footnote text if it cannot be resolved to a reference link definition.

Many existing implementations largely agree with CM about link labels which start with a circumflex, so will try to turn them into links. If the respective reference link definition only contains a single string without whitespace, it will be used as the URL. I believe CM could be prepared better for extensions if reference link definitions were slightly changed: the link destination should be optional when a link title (in parentheses, single or double quotation marks) follows (or possibly any part of an info string that cannot be interpreted as the destination URL). However, feeding empty or degenerate URLs did not have the expected results in CM-compatible implementations and some others – at least unless I separate the ill-formed link definitions from the rest by blank lines.

An extension or postprocessor that hooks into the AST could simply check whether the first character of <text> within <link> is ^ and then modify it accordingly. This also avoid stuff like parsing the destination # as the start of a heading, which is something that happens in several implementations that support footnotes. Link titles, which become footnote texts, do not support blank lines inside and thus no paragraphs, but may contain inline formatting.

A minor drawback perhaps, the original location of the link definition will be lost already at this point, so all notes will necessarily be automatically placed at either the (page) foot or the (document) end.

Babelmark 3
Dingus

PS: The reference implementations do not agree about empty URLs inside angle brackets:

[label]: <> "title"

A link destination consists of either

  • a sequence of zero or more characters between an opening < and a closing >