The problem#
In a recent post, I wanted to include a large code block of a log. In
order to not make the reader scroll past that long block, I put it in a
footnote. But triple-backtick (```
) syntax for code blocks
doesn't work in Python Markdown footnotes:
[^1]: Broken footnote, do not use:
```py
print("Hello World!")
```
outputs the code block before the footnote, not inside it.
The solution#
For code blocks in footnotes, indent the code lines (and use :::
on the first line to specify the highlighting mode if desired). For
example, the Markdown for the footnote in that post starts as follows:
[^full-journalctl-log]:
The full log:
:::text
Aug 09 02:43:20 host systemd[1]: Starting unifi.service - unifi...
Aug 09 02:43:20 host unifi-network-service-helper[2203]: grep: /var/lib/unifi/system.properties: Permission denied