我也在寻找这个,它是一个 PITA 发现如何做到这一点,没有多少谷歌内容,最准确的发现是一个在这里不起作用的要点......死简单的解决方案:
./_plugins/markdown_tag.rb
:
module Jekyll
class MarkdownTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
@text = text.strip
end
require "kramdown"
def render(context)
tmpl = File.read File.join Dir.pwd, "_includes", @text
Jekyll::Converters::Markdown::KramdownParser.new(Jekyll.configuration()).convert(tmpl)
end
end
end
Liquid::Template.register_tag('markdown', Jekyll::MarkdownTag)
更新:博客使用示例:https ://web.archive.org/web/20161207125751/http://wolfslittlestore.be/2013/10/rendering-markdown-in-jekyll/