Skip to content

Instantly share code, notes, and snippets.

@antoinelyset
Created September 1, 2014 13:09
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 antoinelyset/16715598b6cfadb5f676 to your computer and use it in GitHub Desktop.
Save antoinelyset/16715598b6cfadb5f676 to your computer and use it in GitHub Desktop.
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