retrospring/app/helpers/markdown_helper.rb

12 lines
371 B
Ruby
Raw Normal View History

2014-12-28 19:06:49 +01:00
module MarkdownHelper
def markdown(content)
2015-01-12 13:00:00 +01:00
md = Redcarpet::Markdown.new(FlavoredMarkdown, MARKDOWN_OPTS)
Sanitize.fragment(md.render(content), EVIL_TAGS).html_safe
2014-12-28 19:06:49 +01:00
end
2015-01-12 13:00:00 +01:00
def strip_markdown(content)
md = Redcarpet::Markdown.new(Redcarpet::Render::StripDown, MARKDOWN_OPTS)
CGI.unescape_html Sanitize.fragment(md.render(content), EVIL_TAGS)
end
2014-12-28 19:06:49 +01:00
end