You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
A third option I can think of is to offer a switch for removing footnotes completely. It looks like someone already did this using hand-rolled nokogiri to remove footnotes from excerpted posts, which is similar to what I'm trying to do.
I can imagine a solution similar to what is done with the auto_id_prefix option, i.e. a new option called footnote_prefix that gets used on conversion. Would this solve your problem?
@pjpoole This will be in the release coming out today. I.e. there is a new option footnote_prefix that allows you to avoid duplicate IDs.
Additionally, I have added the footnote count of the document to the options of the root element.
Together with the option footnote_nr it is now possible to output multiple documents together with consecutively number footnotes and unique IDs:
require'kramdown/document'total_footnotes=0documents=["footnote[^a][^a]\n\n[^a]: My note\n[^b]: another (ignored) note","footnote[^a][^a]\n\n[^a]: My note\n[^b]: another (ignored) note","footnote[^a][^a]\n\n[^a]: My note\n[^b]: another (ignored) note",]documents.eachdo |document|
document=Kramdown::Document.new(document,{footnote_nr: total_footnotes + 1,footnote_prefix: total_footnotes + 1})putsdocument.to_htmltotal_footnotes += document.root.options[:footnote_count]end
Activity
pjpoole commentedon Jan 2, 2018
A third option I can think of is to offer a switch for removing footnotes completely. It looks like someone already did this using hand-rolled nokogiri to remove footnotes from excerpted posts, which is similar to what I'm trying to do.
gettalong commentedon Jan 5, 2018
Thank you for pointing out this problem!
I can imagine a solution similar to what is done with the
auto_id_prefixoption, i.e. a new option calledfootnote_prefixthat gets used on conversion. Would this solve your problem?pjpoole commentedon Jan 5, 2018
It certainly would!
gettalong commentedon Jun 24, 2018
@pjpoole This will be implemented for the next release.
gettalong commentedon Jan 20, 2019
@pjpoole This will be in the release coming out today. I.e. there is a new option
footnote_prefixthat allows you to avoid duplicate IDs.Additionally, I have added the footnote count of the document to the options of the root element.
Together with the option
footnote_nrit is now possible to output multiple documents together with consecutively number footnotes and unique IDs:results in: