Retrospring/app/helpers/markdown_helper.rb

23 lines
947 B
Ruby
Raw Normal View History

2014-12-28 10:06:49 -08:00
module MarkdownHelper
2015-01-08 13:28:56 -08:00
include EmojiHelper
2014-12-28 10:06:49 -08:00
def markdown(content)
md = Redcarpet::Markdown.new(FlavoredMarkdown,
filter_html: true,
escape_html: true,
no_images: true,
no_styles: true,
safe_links_only: true,
xhtml: false,
hard_wrap: true,
no_intra_emphasis: true,
tables: true,
fenced_code_blocks: true,
autolink: true,
disable_indented_code_blocks: true,
strikethrough: true,
2015-01-08 09:10:20 -08:00
superscript: false)
2015-01-08 13:28:56 -08:00
emojify Sanitize.fragment(md.render(content), EVIL_TAGS).html_safe
2014-12-28 10:06:49 -08:00
end
end