Is there any way to render footnotes without the enclosing <p>?

I know the use of <p> elements in <li>s is technically legal, but it causes bugs in Chrome and Firefox when list-style-position: inside; is applied to the surrounding list. (html - CSS list-style-position makes line breaks when I don't want it - Stack Overflow)

There is no way to emulate the behavior of list-style-position: inside; without it, and goldmark’s automatic insertion of <p>s where none are technically necessary is tripping me up. Is there a way to get rid of them without resorting to dirty hacks?

No, there isn’t.

Thanks for the quick reply. Dirty hacks it is.

which ones though ? I’m interested, if not in this case (although), but in general, wherever that could apply.

If I had to guess, the good old replaceRE.

Can you even use replaceRE on rendered pages? I was thinking of running a python script on all rendered pages, using beautifulsoup to filter out all <p> elements.

Yeah. I just tested and it seems to be working:

{{ $footnoteLiWithP := `(<li id="fn:.">)(?:.|\n)+?(?:<p>)(.*?)(?:</p>)(?:.|\n)+?(</li>)` }}
{{ $footnoteLiWhithoutP := printf `${1} ${2} ${3}` }}

{{ .Content | replaceRE $footnoteLiWithP $footnoteLiWhithoutP | safeHTML }}

Unless I misunderstood something.