Alir3z4 / html2text

Convert HTML to Markdown-formatted text.
alir3z4.github.io/html2text/
GNU General Public License v3.0
1.76k stars 270 forks source link

Add option to ignore leading/trailing whitespace inside <a> tag #329

Open ExplodingCabbage opened 4 years ago

ExplodingCabbage commented 4 years ago

2020.1.16

echo 'Visit: <a href="http://example.com"> http://example.com </a>' | html2text

This produces:

Visit: [ http://example.com ](http://example.com)

but it would be nicer if it produced:

Visit: <http://example.com>

I recognise that theoretically the whitespace can be meaningful to the rendering of the HTML, but it just as often isn't, and having an option to ignore it would be nice. (In fact, I'd suggest that option should be the default.)

Python 3.7.5

jeremydouglass commented 4 years ago

Such a default could cause problems. For one example:

While editing I<a href="foo.com"> highlighted this </a>wrong.

While editing Ihighlighted thiswrong.

ExplodingCabbage commented 4 years ago

Fair point! I guess the default should remain unchanged, then.