text-clipper
has become a Deno-first library and is now available on Jsr.io. Instructions for installation on Node.js/Bun are still included.- Fix #18: Don't include spaces before the indicator.
- Fix #19: Introduce a new option
insertIndicatorAtLinebreak
(default:true
). If you want to keep the behavior oftext-clipper
v2, you should set this back tofalse
. - Tweak in behavior: The indicator is never inserted if only whitespace remains after the clipping point.
- Implement #14: Add
stripTags
option. - Tiny Unicode fix.
- Treat
<audio>
and<video>
as unbreakable elements.
- Implement #12: Improve support for clipping HTML tables.
- Use TypeScript primarily to ease Deno support.
- Assume
Array.prototype.includes()
is available. - Upgraded development dependencies.
- Add TypeScript definition.
- Fix #7: Fix two edge cases:
- Incorrect result when
maxLength
is less than the size of the indicator. - Incorrect indicator when the remaining HTML contains a mix of block and inline elements.
- Incorrect result when
- Tiny optimization when processing HTML tags.
- Fix #4: Correct clip length when using no indicator (indicator is an empty string).
- Fix #5: Support ampersands that do not start an HTML character reference.
- Fix building in React Native.
- Improved tag handling and newline counting (#2, thanks to @churchs19).