Skip to content

Commit

Permalink
Make sure RDiscount autolinks URLs (silly RDiscount)
Browse files Browse the repository at this point in the history
  • Loading branch information
lsegal committed May 16, 2011
1 parent 6fa0f32 commit 5043afc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/yard/templates/helpers/html_helper.rb
Expand Up @@ -58,7 +58,12 @@ def htmlify(text, markup = options[:markup])
# @since 0.6.0
def html_markup_markdown(text)
# TODO: other libraries might be more complex
markup_class(:markdown).new(text).to_html
provider = markup_class(:markdown)
if provider.to_s == 'RDiscount'
markup_class(:markdown).new(text, :autolink).to_html
else
markup_class(:markdown).new(text).to_html
end
end

# Converts Textile to HTML
Expand Down
7 changes: 7 additions & 0 deletions spec/templates/helpers/html_helper_spec.rb
Expand Up @@ -114,6 +114,13 @@ def options; {} end
File.should_receive(:read).with('foo.rdoc').and_return('= HI')
htmlify("{include:file:foo.rdoc}", :rdoc).gsub(/\s+/, '').should == "<p><h1>HI</h1></p>"
end

it "should autolink URLs (markdown specific)" do
log.enter_level(Logger::FATAL) do
pending 'This test depends on markdown' unless markup_class(:markdown)
end
htmlify('http://example.com', :markdown).should include('<a href="http://example.com"')
end
end

describe "#link_object" do
Expand Down

0 comments on commit 5043afc

Please sign in to comment.