Skip to content

Instantly share code, notes, and snippets.

@antoinelyset
Created September 1, 2014 13:09
Embed
What would you like to do?
Markdown in Rails with Kramdown
# config/initializers/templates.rb
module KramdownTemplateHandler
def self.call(template)
"'#{Kramdown::Document.new(template.source).to_html}'.html_safe"
end
end
ActionView::Template.register_template_handler :md, KramdownTemplateHandler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment