Releases: oe/truncate-html
Fix Cheerio's break changes
Cheerio released stable v1.0 a few days ago, but its APIs are very different from the latest beta version 1.0.0-rc.12, which breaks this lib.
The v1.1.2
release has pinned the cheerio version to 1.0.0-rc.12
to fix the cheerio problem.
Reference:
Cheerio spent years on beta version of 1.0, and then bring so many break changes in stable version? Unbelievable!
update cheerio to v1.0.0-rc.12
There are several changes:
- no vulnerabilities
- cheerio can now handle CJK characters correctly
- if you are using custom cheerio instance with this library, you should set the third parameter of
cheerio.load
tofalse
to get rid of extra wrappers, see load for details. - better support for typescript
v1.0.0 has been released🎉
After a hard work, thanks to @calebeno v1.0.0
has been released
- added test cases, covered all statements/lines/branches, fixed some bugs, you can use truncate-html with faith
- added new option reserveLastWord to deal with when truncate in the middle of a word
- supports ES6 Modules, optimized for webpack/rollup
- upgraded
cheerio
tov0.22.0
Added test cases and `options.reserveLastWord`
- added test cases, covered all statements/lines/branches, fixed some bugs.
- added new option
reserveLastWord
to deal with when truncate in the middle of a word - supports ES6 Modules, optimized for webpack/rollup
Thanks to @cenoicc 's help
truncating by words just supported
By setting option byWords
to true
, then option length
means word count.
extra whitespaces can be reserved now
By setting option keepWhitespaces
to true
, you can keep the extra whitespaces when dealing with tags like pre
.
By default continuous whitespace will be replaced to one space, setting keepWhitespaces
to true
can disable it.