Skip to content

Unique IDs for footnotes with the same names #483

@pjpoole

Description

@pjpoole

This author highlighted a problem I am currently having: #56

His answer was different than mine. I prefer to use numbers, and even if I do use custom footnote names, I don't trust myself to never re-use a single name for multiple footnotes that may show up in the same view.

It looks like one solution would be to keep track of a global context and manually advance the starting footnote number as I render posts in a blog index page, but I don't see a way to query a Kramdown document to ask how many footnotes it sees. (i.e., something like:

total_footnotes = 0

documents.each do |document|
  rendered = Kramdown::Document.new(document, { footnote_nr: total_footnotes + 1 })
  total_footnotes += renderered.footnote_count
end

but an easier solution would be the option to add in some sort of nonce into each footnote reference so that the ids would be like fn:1-adf123.

Metadata

Metadata

Assignees

Labels

enhancementnext releaseThese issues/PR will be done for the next release.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions