Improve situation with markdown parsing
This commit is contained in:
parent
333e063161
commit
657ddab1de
@ -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
|
||||||
|
@ -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 = {})
|
||||||
|
@ -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
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user