2011-12-24 19 views
2

我正在嘗試使用它們的:redcarpet濾鏡過濾Nanoc 3中的內容。我的代碼如下所示(從規則文件):如何將擴展程序傳遞到Redcarpet Nanoc濾鏡

compile '/posts/*/' do 
    filter :redcarpet 
    layout 'default' 
end 

我想選擇:fenced_code_blocks傳遞給了隆重的接待擴展,使我可以突出語法。我找不到如何做到這一點的例子。 https://github.com/tanoku/redcarpet描述了在使用redcarpet時如何做到這一點。 Nanoc的文檔表明,我可以通過選項http://nanoc.stoneship.org/docs/api/3.2/Nanoc3/Filters/Redcarpet.html,但沒有任何我嘗試過的。

這裏的一些事情,不工作:

filter :redcarpet, :fenced_code_blocks => true 
filter :redcarpet, :options => [:fenced_code_blocks] 
filter :redcarpet, { :options => [:fenced_code_blocks] } 
filter :redcarpet, { :options => { :fenced_code_blocks => true } } 
filter :redcarpet, { :options => [{ :fenced_code_blocks => true }] } 
filter :redcarpet, { :fenced_code_blocks => true } 

很多這看起來並不像正確的紅寶石,它只是刺在黑暗中。我實際上並不知道規則文件中會出現什麼樣的DSL魔法。任何幫助表示讚賞。

回答

1

使用Redcarpet 1.x,您可以使用:options => [ :foo, :bar, :baz ]傳遞選項,但似乎只有Redcarpet 2.x支持隔離代碼塊,並且nanoc還不支持Redcarpet 2.x.

我遺憾的是沒有測試隆重的接待2和nanoc整合,因爲隆重的接待2使Ruby來這裏......段錯誤

丹尼斯

相關問題