JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18665
  • Score
    100M100P100Q132694F

truncate html text and keep tag safe

Package Exports

  • html-truncate

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (html-truncate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

motivation

To create a library ease to truncate HTML text and keep tag safe

example

var string = '<p><div>hello world</div></p>';

truncate(string, 5) =======> '<p><div>hello</div></p>'

output HTML

hello

string = '<p><div>Do you <b>think</b> it is useful</div></p>';

truncate(string, 10) =======> '<p><div>Do you <b>thi</b></div></p>'

output HTML

Do you thi

demo

./demo

npm package

npm install html-truncate