Skip to content

Commit

Permalink
Do not strip "markdown" in links when posting to services, fix diaspo…
Browse files Browse the repository at this point in the history
  • Loading branch information
jhass committed Nov 26, 2012
1 parent 9957759 commit bf698f3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Force Typhoeus/cURL to use the CA bundle we query via the config. Also add a setting for extra verbose output.
* Validate input on sending invitations, validate email format, send correct ones. [#3748](https://github.com/diaspora/diaspora/pull/3748), [#3271](https://github.com/diaspora/diaspora/issues/3271)
* moved Aspects JS initializer to the correct place so aspect selection / deselection works again [#3737] (https://github.com/diaspora/diaspora/pull/3737)
* Do not strip "markdown" in links when posting to services [#3765](https://github.com/diaspora/diaspora/issues/3765)

# 0.0.2.0

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/markdownify_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def markdownify(target, render_options={})
end

def strip_markdown(text)
renderer = Redcarpet::Markdown.new(Redcarpet::Render::StripDown)
renderer = Redcarpet::Markdown.new(Redcarpet::Render::StripDown, :autolink => true)
renderer.render(text)
end

Expand Down
8 changes: 7 additions & 1 deletion spec/helpers/markdownify_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
require 'spec_helper'

describe MarkdownifyHelper do

describe "#markdownify" do
describe "not doing something dumb" do
it "strips out script tags" do
Expand Down Expand Up @@ -86,4 +85,11 @@
end
end
end

describe "#strip_markdown" do
it 'does not remove markdown in links' do
message = "some text and here comes http://exampe.org/foo_bar_baz a link"
strip_markdown(message).should match message
end
end
end
5 changes: 2 additions & 3 deletions spec/models/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,16 @@
end

it 'removes text formatting markdown from post text' do
service = Service.new()
service = Service.new
message = "Text with some **bolded** and _italic_ parts."
post = stub(:text => message)
service.public_message(post, 200, '', false).should match "Text with some bolded and italic parts."
end

it 'keeps markdown in post text when specified' do
service = Service.new()
service = Service.new
message = "Text with some **bolded** and _italic_ parts."
post = stub(:text => message)
service.public_message(post, 200, '', false, true).should match 'Text with some \*\*bolded\*\* and _italic_ parts.'
end

end

0 comments on commit bf698f3

Please sign in to comment.