diff --git a/app/helpers/markdownify_helper.rb b/app/helpers/markdownify_helper.rb index 9ba17f019..bcac67dab 100644 --- a/app/helpers/markdownify_helper.rb +++ b/app/helpers/markdownify_helper.rb @@ -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 diff --git a/spec/helpers/markdownify_helper_spec.rb b/spec/helpers/markdownify_helper_spec.rb index e5778a9e6..c4dc4ff20 100644 --- a/spec/helpers/markdownify_helper_spec.rb +++ b/spec/helpers/markdownify_helper_spec.rb @@ -42,6 +42,24 @@ describe MarkdownifyHelper do formatted.should =~ %r{#markdown} 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 #multi_word 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 #multi_word_tag yo} + end + it "should leave mentions intact" do message = Factory.create(:status_message, :author => alice.person,