Skip to content

Instantly share code, notes, and snippets.

@wangzuo
Forked from stephencelis/redcarpet.rb
Created September 23, 2012 12:24
Show Gist options
  • Save wangzuo/3770324 to your computer and use it in GitHub Desktop.
Save wangzuo/3770324 to your computer and use it in GitHub Desktop.
Redcarpet (Markdown) template handler for Rails 3.1.
# config/initializers/redcarpet.rb
class ActionView::Template
class Redcarpet < Handler
include Handlers::Compilable
def compile template
::Redcarpet.new(template.source).to_html.inspect
end
end
register_template_handler :markdown, Redcarpet
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment