Merge pull request #594 from Retrospring/</3
Prevent Twitter markdown from stripping `<///3`
This commit is contained in:
commit
a87a06e69f
|
@ -7,12 +7,12 @@ module MarkdownHelper
|
|||
|
||||
def strip_markdown(content)
|
||||
md = Redcarpet::Markdown.new(Redcarpet::Render::StripDown, MARKDOWN_OPTS)
|
||||
CGI.unescape_html(Sanitize.fragment(md.render(content), EVIL_TAGS)).strip
|
||||
CGI.unescape_html(Sanitize.fragment(CGI.escape_html(md.render(content)), EVIL_TAGS)).strip
|
||||
end
|
||||
|
||||
def twitter_markdown(content)
|
||||
md = Redcarpet::Markdown.new(TwitteredMarkdown, MARKDOWN_OPTS)
|
||||
CGI.unescape_html(Sanitize.fragment(md.render(content), EVIL_TAGS)).strip
|
||||
CGI.unescape_html(Sanitize.fragment(CGI.escape_html(md.render(content)), EVIL_TAGS)).strip
|
||||
end
|
||||
|
||||
def question_markdown(content)
|
||||
|
|
|
@ -59,6 +59,10 @@ describe MarkdownHelper, type: :helper do
|
|||
expect(twitter_markdown("@test")).to eq("test")
|
||||
end
|
||||
end
|
||||
|
||||
it "should not strip weird hearts" do
|
||||
expect(twitter_markdown("<///3")).to eq("<///3")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#question_markdown" do
|
||||
|
|
Loading…
Reference in New Issue