Skip to content

Instantly share code, notes, and snippets.

@blacktaxi
Created August 30, 2013 08:54
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 blacktaxi/6387786 to your computer and use it in GitHub Desktop.
Save blacktaxi/6387786 to your computer and use it in GitHub Desktop.
Inline markdown blocks in Jekyll layouts/pages.
module Jekyll
class MarkdownBlock < Liquid::Block
def initialize(tag_name, text, tokens)
super
end
require "kramdown"
def render(context)
content = super
"#{Kramdown::Document.new(content).to_html}"
end
end
end
Liquid::Template.register_tag('markdown', Jekyll::MarkdownBlock)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment