-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from hugoabonizio/fix/markdown-compability
Stdlib markdown compability
- Loading branch information
Showing
2 changed files
with
17 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
require "./spec_helper" | ||
require "html" | ||
require "markdown" | ||
|
||
describe Autolink do | ||
it "auto link URLs" do | ||
|
@@ -77,7 +78,7 @@ describe Autolink do | |
auto_link("<p>#{url}</p>").should eq "<p>#{generate_result(url)}</p>" | ||
end | ||
|
||
it "already linked" do | ||
it "ignores already linked" do | ||
contents = [ | ||
"<a href=\"https://github.com\">https://github.com</a>", | ||
"Welcome to my new blog at <a href=\"http://www.myblog.com/\" class=\"menu\" target=\"_blank\">http://www.myblog.com/</a>. Please e-mail me at <a href=\"mailto:[email protected]\" class=\"menu\" target=\"_blank\">[email protected]</a>.", | ||
|
@@ -99,4 +100,18 @@ describe Autolink do | |
link = HTML.escape(%q(<a href="example">http://example.com</a>)) | ||
auto_link(link).should eq %q(<a href="example"><a href="http://example.com">http://example.com</a></a>) | ||
end | ||
|
||
it "plays well with stdlib markdown" do | ||
content = <<-EOF | ||
auto_link("My blog: http://www.myblog.com") | ||
My blog: <a href="http://www.myblog.com">http://www.myblog.com</a> | ||
EOF | ||
|
||
expected = <<-EOF | ||
<p>auto_link("My blog: <a href="http://www.myblog.com">http://www.myblog.com</a>") | ||
My blog: <a href="http://www.myblog.com">http://www.myblog.com</a></p> | ||
EOF | ||
|
||
auto_link(Markdown.to_html(content)).should eq expected | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters