cyr*_*sza 3 ruby markdown plugins jekyll redcarpet
我想修改一些html标签在jekyll上呈现的方式.我需要的是自动添加一些css类(在本例中为".table"类到表html标记).
我正在使用redcarpet降价处理器.我想我需要编写一个扩展渲染器的插件,但我找不到任何好的例子......
我想出了这个,但它只是一个复制/粘贴工作,它不起作用......
require 'redcarpet'
class BootstrapTables < Redcarpet::Render::HTML
def table(header, body)
"\n<table class='table'><thead>\n#{ header }</thead><tbody>\n#{ body }</tbody></table>\n"
end
end
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?
我已经测试过你可以用kramdown给一个降格元素的类
{:.foo}
| First Header | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |
Run Code Online (Sandbox Code Playgroud)
你的表有foo类
注意: 这个答案是在一个月前发布的