Skip to content
Browse files

Merge pull request #2300 from Pistos/issue-2213-hashtag-markdown-em-c…

…ollision

Issue 2213 hashtag markdown em collision
  • Loading branch information...
2 parents 6df5904 + db4bfb7 commit 73d3bf46b3c4f3a2461193c27376d1fd834060ec @danielgrippi danielgrippi committed Nov 2, 2011
Showing with 22 additions and 3 deletions.
  1. +4 −3 app/helpers/markdownify_helper.rb
  2. +18 −0 spec/helpers/markdownify_helper_spec.rb
View
7 app/helpers/markdownify_helper.rb
@@ -13,13 +13,14 @@ def markdownify(target, render_options={})
: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 @@ def markdownify(target, render_options={})
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
View
18 spec/helpers/markdownify_helper_spec.rb
@@ -42,6 +42,24 @@
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,

0 comments on commit 73d3bf4

Please sign in to comment.
Something went wrong with that request. Please try again.