2013-02-21 84 views
1

脚注考虑的例子中,我跑在IRB如下:逐字从<a href="http://kramdown.rubyforge.org/syntax.html#footnotes" rel="nofollow">http://kramdown.rubyforge.org/syntax.html#footnotes</a>启用Kramdown

Kramdown::Document.new('This is some text.[^1]. Other text.[^footnote].').to_html 

将返回:

"<p>This is some text.[^1]. Other text.[^footnote].</p>\n" 

这似乎表明,脚注Kramdown默认是禁用的。我如何启用它们?我查看了[选项文档](http://kramdown.rubyforge.org/options.html),但我没有看到启用/禁用那里列出脚注的选项。

回答

3

docs you link to

如果找到符合标识符的脚注定义,脚注将被创建。否则,脚注标记不会转换为脚注链接。

因此,您需要包含脚注定义,例如(有一个更完整的例子进一步下跌的页面的文档):

This is some text.[^1]. Other text.[^footnote]. 

[^1]:A footnote. 

这将产生:

<p>This is some text.<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup>. Other text.[^footnote].</p> 

<div class="footnotes"> 
    <ol> 
    <li id="fn:1"> 
     <p>A footnote.<a href="#fnref:1" rel="reference">&#8617;</a></p> 
    </li> 
    </ol> 
</div> 

注意,因为它已被定义生成用于[^1]脚注,但[^footnote]留就这样。

相关问题