diff --git a/include/html2text.php b/include/html2text.php index 0c1ec08330d8a8c77acd80d1f187d6b6c0d7d4a4..1d12c733c3d3582bc3daede37cd9580b08a88314 100644 --- a/include/html2text.php +++ b/include/html2text.php @@ -448,6 +448,11 @@ class HtmlAElement extends HtmlInlineElement { $href = substr($href, 7); $output = (($href != $output) ? "$href " : '') . "<$output>"; } elseif (mb_strwidth($href) > $width / 2) { + if (mb_strwidth($output) > $width / 2) { + // Parse URL and use relative path part + if ($PU = parse_url($output)) + $output = $PU['host'] . $PU['path']; + } if ($href != $output) $id = $this->getRoot()->addFootnote($output, $href); $output = "[$output][$id]";