Warm tip: This article is reproduced from serverfault.com, please click

How can I use inline footnote in markdown in blogdown?

发布于 2020-12-03 18:31:46

I found Yihui Xie used inline footnote in his blog(source).

they use literate programming to explain TeX code.^[Is that because TeX code is particularly difficult to understand? I don't know. I don't understand TeX well.]

footnote

I created a site using hugo-ivy theme and used inline footnote in the homepage.

The content was:

---
title: Home
---

Here is an inline note^[Inline footnote does not work.].

Here is a footnote reference[^1].

[^1]: Reference footnote works.

But inline footnote does not work.

my-footnote

How can I use inline footnote in markdown file like Yihui?

You can visit demo website and clone source code to test.

Environment: Hugo 0.79.0, Blogdown 0.21.47

Questioner
Cyrus Yip
Viewed
0
Yihui Xie 2020-12-04 11:37:45

I'm still using Hugo 0.25.1 at the moment. Its Markdown renderer is Blackfriday, which supports inline footnotes. Hugo switched the default Markdown renderer to Goldmark since v0.60.0. Unfortunately, Goldmark doesn't support inline footnotes, and its author doesn't seem to be interested in supporting this feature, either.

You could use Blackfriday as the Markdown renderer, but it will be deprecated eventually, so unless you are sure that you want to stick to a particular version of Hugo, this is probably not a good way to go. The alternative way is to use an editor that makes it easier to write footnotes, such as the RStudio visual Markdown editor (then you won't need to think about footnote IDs).