Added a test for mailto: links
This commit is contained in:
parent
77541b6b09
commit
2b1bfbf52a
@ -65,7 +65,7 @@ class LinkRenderer extends \League\CommonMark\Inline\Renderer\LinkRenderer
|
|||||||
|
|
||||||
protected function isExternalUrl($url)
|
protected function isExternalUrl($url)
|
||||||
{
|
{
|
||||||
return preg_match('|^(?:[a-z]+:)?//|', $url) || substr($url, 0, 7) == "mailto:";
|
return preg_match('#^(?:[a-z]+:)?//|^mailto:#', $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,6 +51,9 @@ class LinkRendererTest extends \PHPUnit_Framework_TestCase
|
|||||||
// /Content/Page
|
// /Content/Page
|
||||||
['<a href="../Widgets/Button.html">Link</a>', '[Link](../Widgets/Button.md)', 'Content/Page.html'],
|
['<a href="../Widgets/Button.html">Link</a>', '[Link](../Widgets/Button.md)', 'Content/Page.html'],
|
||||||
['<a href="../Widgets/Button.html">Link</a>', '[Link](!Widgets/Button)', 'Content/Page.html'],
|
['<a href="../Widgets/Button.html">Link</a>', '[Link](!Widgets/Button)', 'Content/Page.html'],
|
||||||
|
|
||||||
|
// Mailto links
|
||||||
|
['<a href="mailto:me@mydomain.com" class="external">me@mydomain.com</a>', '[me@mydomain.com](mailto:me@mydomain.com)', 'Content/Page.html'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user