blob: dc60e98e575647180849a1fb191ea551173b6334 [file] [log] [blame]
module Jekyll
class MarkdownTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
@text = text.strip
end
require "kramdown"
def render(context)
@f = File.read(File.join(Dir.pwd, @text))
if @f =~ /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m
@f = $POSTMATCH
end
"#{Kramdown::Document.new(@f).to_html}"
end
end
end
Liquid::Template.register_tag('markdown', Jekyll::MarkdownTag)