Improve situation with markdown parsing

This commit is contained in:
Marcin Kulik 2012-07-25 23:01:01 +02:00
parent 333e063161
commit 657ddab1de
3 changed files with 8 additions and 6 deletions

View File

@ -26,10 +26,6 @@ class ApplicationDecorator < Draper::Base
# formatted_timestamp(model.updated_at) # formatted_timestamp(model.updated_at)
# end # end
def markdown(text)
MKD_RENDERER.render(text)
end
def as_json(*args) def as_json(*args)
model.as_json(*args) model.as_json(*args)
end end

View File

@ -102,7 +102,7 @@ class AsciicastDecorator < ApplicationDecorator
def formatted_description def formatted_description
text = model.description.to_s text = model.description.to_s
MKD_RENDERER.render(text).html_safe MKD_SAFE_RENDERER.render(text).html_safe
end end
def author_profile_link(options = {}) def author_profile_link(options = {})

View File

@ -1,5 +1,11 @@
MKD_RENDERER = Redcarpet::Markdown.new( MKD_SAFE_RENDERER = Redcarpet::Markdown.new(
Redcarpet::Render::HTML.new(:filter_html => true, :hard_wrap => true), Redcarpet::Render::HTML.new(:filter_html => true, :hard_wrap => true),
:no_intra_emphasis => true, :no_intra_emphasis => true,
:autolink => true :autolink => true
) )
MKD_RENDERER = Redcarpet::Markdown.new(
Redcarpet::Render::HTML.new,
:no_intra_emphasis => true,
:autolink => true
)