Skip to content

Commit

Permalink
#23 GFM auto-link recreated an existing link
Browse files Browse the repository at this point in the history
  • Loading branch information
kzykhys committed Dec 4, 2013
1 parent 62a318e commit 6c1272e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Ciconia/Extension/Gfm/UrlAutoLinkExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function register(Markdown $markdown)
*/
public function processStandardUrl(Text $text)
{
$text->replace('{(?<!]\(|"|<)((?:https?|ftp)://[^\'">\s]+)(?!>)}', '<\1>');
$text->replace('{(?<!]\(|"|<|\[)((?:https?|ftp)://[^\'">\s]+)(?!>|\"|\])}', '<\1>');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/Ciconia/Resources/gfm/links.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[GFM][] will [autolink](https://help.github.com/articles/github-flavored-markdown#url-autolinking) standard URLs, so if you want to link to a URL (instead of setting link text),
you can simply enter the URL like http://example.com/ and it will be turned into a link to that URL.
you can simply enter the URL like http://example.com/ and it will be turned into a link to that URL. [http://www.example.com](http://www.example.com)

Internally, the URL will be turned into <http://example.com/>.

Expand Down
2 changes: 1 addition & 1 deletion test/Ciconia/Resources/gfm/links.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p><a href="https://help.github.com/articles/github-flavored-markdown">GFM</a> will <a href="https://help.github.com/articles/github-flavored-markdown#url-autolinking">autolink</a> standard URLs, so if you want to link to a URL (instead of setting link text),<br>
you can simply enter the URL like <a href="http://example.com/">http://example.com/</a> and it will be turned into a link to that URL.</p>
you can simply enter the URL like <a href="http://example.com/">http://example.com/</a> and it will be turned into a link to that URL. <a href="http://www.example.com">http://www.example.com</a></p>

<p>Internally, the URL will be turned into <a href="http://example.com/">http://example.com/</a>.</p>

0 comments on commit 6c1272e

Please sign in to comment.