2014-12-28 10:06:49 -08:00
|
|
|
module MarkdownHelper
|
|
|
|
|
|
|
|
def markdown(content)
|
2015-01-12 04:00:00 -08:00
|
|
|
md = Redcarpet::Markdown.new(FlavoredMarkdown, MARKDOWN_OPTS)
|
2015-01-08 13:34:50 -08:00
|
|
|
Sanitize.fragment(md.render(content), EVIL_TAGS).html_safe
|
2014-12-28 10:06:49 -08:00
|
|
|
end
|
2015-01-12 04:00:00 -08:00
|
|
|
|
|
|
|
def strip_markdown(content)
|
|
|
|
md = Redcarpet::Markdown.new(Redcarpet::Render::StripDown, MARKDOWN_OPTS)
|
2015-01-12 04:08:10 -08:00
|
|
|
CGI.unescape_html(Sanitize.fragment(md.render(content), EVIL_TAGS)).strip
|
2015-01-12 04:00:00 -08:00
|
|
|
end
|
2015-01-29 07:45:58 -08:00
|
|
|
|
|
|
|
def twitter_markdown(content)
|
|
|
|
md = Redcarpet::Markdown.new(TwitteredMarkdown, MARKDOWN_OPTS)
|
|
|
|
CGI.unescape_html(Sanitize.fragment(md.render(content), EVIL_TAGS)).strip
|
|
|
|
end
|
2014-12-28 10:06:49 -08:00
|
|
|
end
|