diff --git a/src/Html2Text.php b/src/Html2Text.php index 056b05e..b74fd57 100644 --- a/src/Html2Text.php +++ b/src/Html2Text.php @@ -426,7 +426,7 @@ protected function buildlinkList($link, $display, $linkOverride = null) } // Ignored link types - if (preg_match('!^(javascript:|mailto:|#)!i', $link)) { + if (preg_match('!^(javascript:|mailto:|#)!i', html_entity_decode($link))) { return $display; } diff --git a/test/LinkTest.php b/test/LinkTest.php index 626fd87..d621c18 100644 --- a/test/LinkTest.php +++ b/test/LinkTest.php @@ -159,4 +159,24 @@ public function testDoLinksWhenTargetInText() $this->assertEquals($expected, $html2text->getText()); } + + public function testMailto() + { + $html = 'Link text'; + $expected = 'Link text'; + + $html2text = new Html2Text($html, array('do_links' => 'inline')); + + $this->assertEquals($expected, $html2text->getText()); + } + + public function testMailtoWithEntity() + { + $html = 'Link text'; + $expected = 'Link text'; + + $html2text = new Html2Text($html, array('do_links' => 'inline')); + + $this->assertEquals($expected, $html2text->getText()); + } }