soundasleep / html2text

A PHP component to convert HTML into a plain text format
MIT License
475 stars 135 forks source link

Ability to change number of new lines in output #94

Closed bytestream closed 2 years ago

bytestream commented 2 years ago

https://github.com/soundasleep/html2text/blob/master/src/Html2Text.php#L298 specifies to output two LF characters per paragraph. Would you accept a PR which allows one to change the number of LF characters that are output?

The use case is similar to the MsoNormal, where no margin exists on the paragraphs. For example:

<p>foo</p><p>&nbsp;</p><p>bar</p><p>quz</p>

Output:

foo

bar
quz
edgrosvenor commented 2 years ago

@bytestream If you can do it without breaking backward compatibility, I'd definitely be open to it.