text-clipper gains ability to strip tags in 2.2.0 release

image

text-clipper is a library for truncating text, both plain text and HTML. With the new 2.2 release, it gained a powerful new ability: stripping tags from HTML input.

Example:

const clipped = clip(
    “<p>Hello <img alt=‘Beautiful’ src=‘#’> World, everyone!</p>”,
    15,
    { html: true, stripTags: [“img”] }
);
// clipped == “<p>Hello  World, …</p>”

Author: Shantun Parmar

Leave a Reply

Your email address will not be published.