arendjr / text-clipper

Fast and correct clip functions for HTML and plain text
MIT License
133 stars 13 forks source link

Treat HTML block elements as new lines #2

Closed churchs19 closed 6 years ago

churchs19 commented 6 years ago

I updated the tests to check the
tag handling since that was incorrect as written.

I also added code to treat all HTML block level elements as new lines in order to make the maxLines parameter more meaningful when the truncated HTML content is displayed on-screen.

arendjr commented 6 years ago

This is a great contribution, thanks!

Please don't check-in the package-lock.json though (it might be good to add it to the gitignore even) as I don't believe it has much value for libraries (as opposed to applications) and I use Yarn myself anyway :) Also, if you could minimize the diff to only code changes instead of including some indentation-only changes, that would be great. Then it should be good to merge!

churchs19 commented 6 years ago

I believe my latest update addresses all of your comments. Thanks for being open to the updates!

arendjr commented 6 years ago

Great, thanks again!

arendjr commented 6 years ago

FYI, I've published v1.2.1 which includes this PR to NPM as well. Cheers!