Skip to content

Instantly share code, notes, and snippets.

@antoinelyset
Created September 1, 2014 13:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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