Is there a way to customise the way Zola parses Markdown footnotes?

In my previous blog which used Hugo, footnotes were parsed as a <section> that contained an <ol> and the <li> had a link back to where the note occurred in the text.

In zola, the footnotes are appearing as a succession of <div><sup>number</sup><p>The footnote.</p></div>s.

This makes styling the footnotes section a bit tougher, since they are not contained in a <div> or <section> or something similar. Also the linkback is missing which I like a lot.

Any idea how I can modify it? Found no mention of it in the docs or the forums so far.

Example:

2 Likes

This is using plain pulldown-cmark so probably not.

Just to clarify: it is therefore normal behavior in Zola — due to pulldown-cmark in particular and CommonMark in general — that footnotes don’t appear at the end of a document (as in most other static site generators) but, instead, appear wherever they are actually entered in the Markdown file? And, also, do I correctly understand that there is no way this can be resolved, due to Zola’s dependence on both pulldown-cmark and CommonMark?

that footnotes don’t appear at the end of a document (as in most other static site generators) but, instead, appear wherever they are actually entered in the Markdown file?

As far as I know, this is how Markdown footnotes have always worked. I could be wrong though, since I’ve always put footnotes at the bottom anyways to keep them « out of site, out of mind » so to speak.

I do agree it is hard to style footnotes to the point where I have to manually create footnotes like:

<sup id="1">1</sup> : Footnote text here

to make it look somewhat decent; otherwise, it splits onto two lines and looks a bit awkward. The fix would be combining the <sup> from the built-in into the <p> where the footnote contents are.

@doamatto Thanks for the reply and info. Actually, the CommonMark approach to footnotes-handling appears to be considerably behind, for example, Multimarkdown in this respect; but it would seem that it’s a long-debated subject in that community. I don’t expect it to get better any time soon.

We can maybe add a class/data attributes to the footnotes through the pulldown-cmark events but I haven’t tried. It should be fairly easy to try though.

1 Like

I can try taking a crack at it; can you point me in the right direction as to where I should put it in the repo?

1 Like

Find the reference event from pulldown-cmark docs, add it to the match and print what it contains

2 Likes

Would be great if this got implemented though I don’t deem it as utterly necessary. I would do it myself but it’s beyond my capabilities. Thanks to everyone for taking interest.