Simon Willison’s Weblog

Subscribe

Footnotes that work in RSS readers. Chris Coyier explained the mechanism used by Feedbin to render custom footnotes back in 2019.

I stumbled upon this after I spotted an inline footnote rendered in NetNewsWire the other day (from this post by Drew Breunig):

NetNewsWire screenshot. A post by Drew Breunig is shown, and a small number one in a pill reveals an overlay displaying a footnote.

Since feed readers generally strip JavaScript and CSS and only allow a subset of HTML tags I was intrigued to figure out how that worked.

I found this code in the NetNewsWire source (it's MIT licensed) which runs against elements matching this CSS selector:

sup > a[href*='#fn'], sup > div > a[href*='#fn']

So any link with an href attribute containing #fn that is a child of a <sup> (superscript) element.

In Drew's post the HTML looks like this:

<!-- Footnote link: -->
<sup id="fnref:precision" role="doc-noteref">
  <a href="#fn:precision" class="footnote" rel="footnote">1</a>
</sup>
<!-- Then at the bottom: -->
<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:precision" role="doc-endnote">
      <p>This is the footnote.
        <a href="#fnref:precision" class="reversefootnote" role="doc-backlink">&#8617;</a>
      </p>
    </li>
  </ol>
</div>

Where did this convention come from? It doesn't seem to be part of any specific standard. Chris linked to www.bigfootjs.com (no longer resolving) which was the site for the bigfoot.js jQuery plugin, so my best guess is the convention came from that.