我只是想在我的GitHub Gist中添加脚注,但它不起作用:

Some long sentence. [^footnote]

[^footnote]: Test, [Link](https://google.com).

我遵循这个指南,我不认为我做错了什么。有人能指出我的错误吗?


当前回答

虽然这个问题是关于GitHub风格的Markdown,但我认为值得一提的是,截至2013年,GitHub支持内置该功能的AsciiDoc。你只需要用.adoc扩展名重命名你的文件,并使用:

A statement.footnote:[Clarification about this statement.]

A bold statement!footnote:disclaimer[Opinions are my own.]

Another bold statement.footnote:disclaimer[]

文档和最终结果在这里。

其他回答

进一步扩展前面的答案,你可以在脚注的链接中添加id属性:

 Bla bla <sup id="a1">[1](#f1)</sup>

然后从脚注中链接回它。

<b id="f1">1</b> Footnote content here. [↩](#a1)

这将在脚注内容的末尾添加一点篇幅,将读者带回到包含脚注链接的行。

这对我来说很管用:

布拉布拉 [<sup>1</sup>] 布拉布拉布拉

脚注: 参考blablabla <a class="anchor" id="1"></a>

这个方法适用于Kaggle笔记本markdown:

Tell the story here.[<sup>[1]</sup>](#f1)

<span id="f1">[1]</span> Detail reference here.

在前面的答案上稍微扩展一下,你也可以在这里设置脚注链接。首先像这样定义底部的脚注

<a name="myfootnote1">1</a>: Footnote content goes here

然后像这样在文档的其他地方引用它

<sup>[1](#myfootnote1)</sup>

GitHub flavour Markdown不支持脚注,但你可以手动使用Unicode字符或上标标记来伪造脚注,例如<sup>1</sup>。

¹当然这并不理想,因为你现在要负责维护脚注的编号。不过,如果你只有一个或两个,它工作得相当好。