2013-02-21 35 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]留就這樣。

相關問題