如何在 blogdown 的降价中使用内联脚注?

How can I use inline footnote in markdown in blogdown?

我发现 Yihui Xie 在他的 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.]

我使用 hugo-ivy theme and used inline footnote in the homepage 创建了一个网站。

内容是:

---
title: Home
---

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

Here is a footnote reference[^1].

[^1]: Reference footnote works.

但是行内脚注不起作用。

如何像易辉一样在markdown文件中使用内联脚注?

您可以访问demo website and clone source code进行测试。

环境:Hugo 0.79.0,Blogdown 0.21.47

我也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支持这个功能。

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(这样你就不需要考虑脚注 ID)。