How can I automatically render partials using markdown in Rails 3?
Turns out, the Right Way ™ to do this is using ActionView::Template.register_template_handler: lib/markdown_handler.rb: require ‘rdiscount’ module MarkdownHandler def self.erb @erb ||= ActionView::Template.registered_template_handler(:erb) end def self.call(template) compiled_source = erb.call(template) “RDiscount.new(begin;#{compiled_source};end).to_html” end end ActionView::Template.register_template_handler :md, MarkdownHandler If you require ‘markdown_handler’ in your config/application.rb (or an initializer), then any view or partial can be rendered as Markdown with … Read more