脚注扩展(Markdig 规范文档)
本节描述了支持的不同扩展:
脚注
允许使用以下语法(取自 Pandoc 示例)创建脚注:
Here is a footnote reference,[^1] and another.[^longnote]
This is another reference to [^1]
[^1]: Here is the footnote.
And another reference to [^longnote]
[^longnote]: Here's one with multiple blocks.
Subsequent paragraphs are indented to show that they
belong to the previous footnote.
> This is a block quote
> Inside a footnote
{ some.code }
The whole paragraph can be indented, or just the first
line. In this way, multi-paragraph footnotes work like
multi-paragraph list items.
This paragraph won't be part of the note, because it
isn't indented.
.
<p>Here is a footnote reference,[<sup>1</sup></a> and another.<a id="fnref:3" href="#fn:2" class="footnote-ref"><sup>2</sup>](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fn:1)</p>
<p>This is another reference to [<sup>1</sup>](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fn:1)</p>
<p>And another reference to [<sup>2</sup>](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fn:2)</p>
<p>This paragraph won't be part of the note, because it
isn't indented.</p>
<div class="footnotes">
<hr />
<ol>
<li id="fn:1">
<p>Here is the footnote.[↩</a><a href="#fnref:2" class="footnote-back-ref">↩](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fnref:1)</p>
</li>
<li id="fn:2">
<p>Here's one with multiple blocks.</p>
<p>Subsequent paragraphs are indented to show that they
belong to the previous footnote.</p>
<blockquote>
<p>This is a block quote
Inside a footnote</p>
</blockquote>
<pre><code>{ some.code }
</code></pre>
<p>The whole paragraph can be indented, or just the first
line. In this way, multi-paragraph footnotes work like
multi-paragraph list items.[↩</a><a href="#fnref:4" class="footnote-back-ref">↩](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fnref:3)</p>
</li>
</ol>
</div>
检查连续多个脚注的情况:
Here is a footnote[^1]. And another one[^2]. And a third one[^3]. And a fourth[^4].
[^1]: Footnote 1 text
[^2]: Footnote 2 text
a
[^3]: Footnote 3 text
[^4]: Footnote 4 text
.
<p>Here is a footnote[<sup>1</sup></a>. And another one<a id="fnref:2" href="#fn:2" class="footnote-ref"><sup>2</sup></a>. And a third one<a id="fnref:3" href="#fn:3" class="footnote-ref"><sup>3</sup></a>. And a fourth<a id="fnref:4" href="#fn:4" class="footnote-ref"><sup>4</sup>](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fn:1).</p>
<p>a</p>
<div class="footnotes">
<hr />
<ol>
<li id="fn:1">
<p>Footnote 1 text[↩](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fnref:1)</p></li>
<li id="fn:2">
<p>Footnote 2 text[↩](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fnref:2)</p></li>
<li id="fn:3">
<p>Footnote 3 text[↩](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fnref:3)</p></li>
<li id="fn:4">
<p>Footnote 4 text[↩](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fnref:4)</p></li>
</ol>
</div>
另一个没有空行分隔的连续脚注测试:
Here is a footnote[^1]. And another one[^2]. And a third one[^3]. And a fourth[^4].
[^1]: Footnote 1 text
[^2]: Footnote 2 text
[^3]: Footnote 3 text
[^4]: Footnote 4 text
.
<p>Here is a footnote[<sup>1</sup></a>. And another one<a id="fnref:2" href="#fn:2" class="footnote-ref"><sup>2</sup></a>. And a third one<a id="fnref:3" href="#fn:3" class="footnote-ref"><sup>3</sup></a>. And a fourth<a id="fnref:4" href="#fn:4" class="footnote-ref"><sup>4</sup>](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fn:1).</p>
<div class="footnotes">
<hr />
<ol>
<li id="fn:1">
<p>Footnote 1 text[↩](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fnref:1)</p></li>
<li id="fn:2">
<p>Footnote 2 text[↩](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fnref:2)</p></li>
<li id="fn:3">
<p>Footnote 3 text[↩](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fnref:3)</p></li>
<li id="fn:4">
<p>Footnote 4 text[↩](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fnref:4)</p></li>
</ol>
</div>
列表中的脚注链接也应正常工作:
- abc
- def[^1]
[^1]: Here is the footnote.
.
<ul>
<li>abc</li>
<li>def[<sup>1</sup>](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fn:1)</li>
</ul>
<div class="footnotes">
<hr />
<ol>
<li id="fn:1">
<p>Here is the footnote.[↩](/docs/zh-Hans/net-lib-docs/master/Markdig/Specs/#fnref:1)</p></li>
</ol>
</div>