Sha256: bea60bfcc69d133b5039f0126fbfe9d6f9d46e2c98708e4e84a24133a8774d2b

Contents?: true

Size: 402 Bytes

Versions: 1

Compression:

Stored size: 402 Bytes

Contents

if !defined?(ActionView)
  raise "All of this only makes sense within rails"
end

require "erb"
require "rdiscount"

class ActionView::MdownHandler < ActionView::TemplateHandler
  def render(template, local_assigns)
    txt = ERB.new(template.source).result(@view.send(:binding))
    RDiscount.new(txt).to_html
  end
end

ActionView::Template.register_template_handler :mdown, ActionView::MdownHandler

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mdown_handler-0.1 lib/mdown_handler.rb