Skip to content

Instantly share code, notes, and snippets.

@jwebcat
Created April 3, 2013 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwebcat/5298218 to your computer and use it in GitHub Desktop.
Save jwebcat/5298218 to your computer and use it in GitHub Desktop.
module Jekyll
class MarkdownTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
@text = text.strip
end
require "kramdown"
def render(context)
"#{Kramdown::Document.new(File.read(File.join(Dir.pwd, '_includes', @text))).to_html}"
end
end
end
Liquid::Template.register_tag('markdown', Jekyll::MarkdownTag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment