Skip to content

Commit

Permalink
Add option to render html at format_helper
Browse files Browse the repository at this point in the history
  • Loading branch information
dpliakos authored and differentreality committed Jun 27, 2017
1 parent 775a93f commit 7fd738b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/helpers/format_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,20 +176,20 @@ def selected_scheduled?(schedule)
(schedule == @selected_schedule) ? 'Yes' : 'No'
end

def markdown(text)
def markdown(text, escape_html=true)
return '' if text.nil?

options = {
autolink: true,
space_after_headers: true,
no_intra_emphasis: true
}
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(escape_html: true), options)
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(escape_html: escape_html), options)
markdown.render(text).html_safe
end

def markdown_hint(text='')
markdown("#{text} Please look at #{link_to '**Markdown Syntax**', 'https://daringfireball.net/projects/markdown/syntax', target: '_blank'} to format your text")
markdown("#{text} Please look at #{link_to '**Markdown Syntax**', 'https://daringfireball.net/projects/markdown/syntax', target: '_blank'} to format your text", false)
end

def quantity_left_of(resource)
Expand Down

0 comments on commit 7fd738b

Please sign in to comment.