d3lity / js-truncate-html

Javascript and php function to truncate/cut html-text and close opened tags.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

js-truncate-html

Javascript function to truncate html-text and closing open tags. Short and sweet.

Usage:

  cut_html("<p><b>html-text seems hard to be truncated</b></p>",26);
  
  // ..and you'll get:
  
  "<p><b>html-text seems hard</b></p>..."

ToDO:

  • Make it only count text, now it also counts tag-characters
  • Remove html-comments before cutting

About

Javascript and php function to truncate/cut html-text and close opened tags.


Languages

Language:PHP 58.4%Language:JavaScript 41.6%