Last active
August 29, 2015 14:14
-
-
Save themattchan/8e99554eed11fcab0dd4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MarkdownBlock | |
# Insert & parse Markdown anywhere, even nested in html | |
# | |
# Author: Matthew Chan <[email protected]> | |
# Date: January 2015 | |
# License: GNU GPL | |
# | |
# Usage: | |
# {% markdown %} | |
# <md_text> | |
# {% endmarkdown %} | |
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,:input => 'GFM').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