Numbering footnote references

Does anyone have a good way of numbering footnotes? I’m leaning toward the route of <sup>#</sup> in $Text, e.g. This is an example footnote1. I would then use the sibling or endnote footnote feature to link the note. I’ll then apply a footnote prototype to these notes, and then have the export template process them as footnotes. I’d love to find a way to automate the number, but this might be overkill.

Thoughts?

I think what you need is code (action or export) that can run during export and find all outbound links of type “note” (i.e. footnote links) and iterate setting HTML anchors instead of and that the end of existing $Text anchor text.

The reverse link (which self respecting hypertext should have is harder) as we need to link to a position (anchor) in the source $Text. One possibility is using the link action for the “Note” link type to set a UID that could be the reverse anchor, for instance an iterated number based on the source note’s $ID, e.g. “1616685937-4” for the fourth footnote created (order within text doesn’t matter). We might imagine the foot note of the footnote sequence #6 in $Text (but fourth in order of creation) exporting a footnote link like this The UID could be exported as the ID of the footnote link, in this case as footnote link #6:

…something something<a href="foootnote26.html" id="x1616685937-4" class="footnote">6<a>, but…

The class can format for using upper case. The prefix inserted on the ID is because HTML Is/anchors shouldn’t start with a number. In the target note, here called ‘footnote26.html’ the reverse link URL to the footnote’s source would look like this:

<a href="somesourcepage.html#x1616685937-4" ...

the # indicating the target ID within the called page, causing the browser to scroll to it (if offscreen). The actual page names and relative locations are moot here as Tinderbox already handles that.

So far so good, but…the methods to achieve all this don’t yet exist.

Assumption: the relationship of source to footnote is one-to-one. If the footnote is called buy several notes the process is much more complex—at least for doing backlinks.

2 Likes

Nice thinking. For now, I’m playing with a brute force method that appears promising. We’ll see.

A further limitation to address is one that’s been on the spike for many years - being able to customise the HTML (or other code) written for links exported as part of $Text. It would be useful if a link could be assigned a value to apply to the HTML ID link attribute. Likewise we need a means to add a #[target_id] suffix to outbound `href`` values.