Markdown in comments
parent
06fcbf65c4
commit
936dac6baa
@ -0,0 +1,10 @@
|
||||
class CommentDecorator < ApplicationDecorator
|
||||
decorates :comment
|
||||
|
||||
def as_json(*args)
|
||||
data = model.as_json(*args)
|
||||
data['processed_body'] = markdown(data['body'])
|
||||
data
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
MKD_RENDERER = Redcarpet::Markdown.new(
|
||||
Redcarpet::Render::HTML.new(:filter_html => true),
|
||||
:no_intra_emphasis => true,
|
||||
:autolink => true
|
||||
)
|
@ -0,0 +1,5 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe CommentDecorator do
|
||||
before { ApplicationController.new.set_current_view_context }
|
||||
end
|
Loading…
Reference in New Issue