我最近将我的博客从Octopress迁移到Pelican。在Octopress中,我使用了一个插件callout.rb。几年前我发现了这个代码。我不知道它的起源了
module Jekyll
class CustomDivBlock < Liquid::Block
def initialize(name, params, tokens)
# Accept a param to capture which wrapper type to use
# and strip it of garbage
@class = params.strip
super
end
def render(context)
# Convert the content to HTML and use the built-in
# markdown renderer (in this case RDiscount)
output = RDiscount.new( super ).to_html
"<div class='docs-#{@class}'>#{output}</div>"
end
end
end
# Register the wrapper with the other templates so you can successfully call it
# The name you use here will be what is used inside the markdown itself
Liquid::Template.register_tag('docs', Jekyll::CustomDivBlock)
我正在尝试将此功能移植到Pelican。我找到了一个插件,它看起来像要查找的方向。我没有足够的技能来开发一个模仿Ruby代码的液态标记处理程序。需要一些帮助/提示
范例
{%docs note%} 这是我的降价内容。 {%enddocs%}
其中note指生成输出的类
目前没有回答
相关问题 更多 >
编程相关推荐