Merge pull request #2300 from Pistos/issue-2213-hashtag-markdown-em-collision
Issue 2213 hashtag markdown em collision
This commit is contained in:
commit
73d3bf46b3
2 changed files with 22 additions and 3 deletions
|
|
@ -13,13 +13,14 @@ module MarkdownifyHelper
|
|||
:space_after_headers => true,
|
||||
:strikethrough => true,
|
||||
:superscript => true,
|
||||
:tables => true
|
||||
:tables => true,
|
||||
:no_intra_emphasis => true,
|
||||
}
|
||||
|
||||
render_options[:filter_html] = true
|
||||
render_options[:hard_wrap] ||= true
|
||||
|
||||
# This ugly little hack basically means
|
||||
# This ugly little hack basically means
|
||||
# "Give me the rawest contents of target available"
|
||||
if target.respond_to?(:raw_message)
|
||||
message = target.raw_message
|
||||
|
|
@ -39,7 +40,7 @@ module MarkdownifyHelper
|
|||
if target.respond_to?(:format_mentions)
|
||||
message = target.format_mentions(message)
|
||||
end
|
||||
|
||||
|
||||
message = Diaspora::Taggable.format_tags(message, :no_escape => true)
|
||||
|
||||
return message.html_safe
|
||||
|
|
|
|||
|
|
@ -42,6 +42,24 @@ describe MarkdownifyHelper do
|
|||
formatted.should =~ %r{<a href="/tags/markdown" class="tag">#markdown</a>}
|
||||
end
|
||||
|
||||
it 'should leave multi-underscore tags intact' do
|
||||
message = Factory.create(
|
||||
:status_message,
|
||||
:author => alice.person,
|
||||
:text => "Here is a #multi_word tag"
|
||||
)
|
||||
formatted = markdownify(message)
|
||||
formatted.should =~ %r{Here is a <a href="/tags/multi_word" class="tag">#multi_word</a> tag}
|
||||
|
||||
message = Factory.create(
|
||||
:status_message,
|
||||
:author => alice.person,
|
||||
:text => "Here is a #multi_word_tag yo"
|
||||
)
|
||||
formatted = markdownify(message)
|
||||
formatted.should =~ %r{Here is a <a href="/tags/multi_word_tag" class="tag">#multi_word_tag</a> yo}
|
||||
end
|
||||
|
||||
it "should leave mentions intact" do
|
||||
message = Factory.create(:status_message,
|
||||
:author => alice.person,
|
||||
|
|
|
|||
Loading…
Reference in a new issue