Kevin Keith Kevin Keith - 1 month ago 8
HTML Question

How can I alter the formatting of pandoc footnote marks?

Suppose I have the following markdown code,

test.md
:

This is a footnote mark.^[Which I would like to show up having brackets]


Using the following command, I then generate HTML:

$ pandoc --ascii test.md -o test.html


which gives me the following HTML:



<p>This is a footnote mark.<a href="#fn1" class="footnoteRef" id="fnref1"><sup>1</sup></a></p>
<div class="footnotes">
<hr />
<ol>
<li id="fn1"><p>Which I would like to show up having brackets<a href="#fnref1">&#8617;</a></p></li>
</ol>
</div>


The salient part of which shows up as:

This is a footnote mark.1

What I would like, is some way to have wikipedia-style superscript links, like so:

This is a footnote mark.[1]

Is there any way to do this? I can't figure it out, short of writing my own writer in lua.

Answer

You can use CSS to style the generated HTML footnotes:

.footnoteRef sup:before {
  content: '[';
}
.footnoteRef sup:after {
  content: ']';
}
<p>This is a footnote mark.<a href="#fn1" class="footnoteRef" id="fnref1"><sup>1</sup></a></p>