Skip to content

Instantly share code, notes, and snippets.

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
You can’t perform that action at this time.