soundasleep/html2text

Suggestion: convert links where URL href = description

Closed this issue · 2 comments

https://github.com/soundasleep/html2text/blob/master/src/Html2Text.php#L291-294

<a href="http://foo.com">http://foo.com</a> is converted to http://foo.com instead of [http://foo.com](http://foo.com)

the latter is the preferred behavior. example use case: URLs are shortened in href but not in description.

This is by design and should already be done! If the URL is different from the description text, then it should use the []() syntax; otherwise it should use just the URL.

e.g. <a href="http://foo.com">Some text</a> should return [some text](http://foo.com).

[http://foo.com](http://foo.com) seems redundant.