TruncateHtml ============ [![Build Status](https://secure.travis-ci.org/hgmnz/truncate_html.png?branch=master)](http://travis-ci.org/hgmnz/truncate_html) [![Code Climate](https://codeclimate.com/github/hgmnz/truncate_html.png)](https://codeclimate.com/github/hgmnz/truncate_html) truncate_html cuts off a string of HTML and takes care of closing any lingering open tags. There are many ways to solve this. This library does not have any dependencies, and [parses HTML using regular expressions](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454). It can be used with or without Rails. Example ------- ```ruby some_html = '
' truncate_html(some_html, length: 15, omission: '...(continued)') => ``` A few notes: * By default, it will truncate on word boundary. To truncate the HTML string strictly at the specified length, pass in the `word_boundary: false` option. * If the input HTML is nil, it will return an empty string. * The omission text's length does count toward the resulting string's length. * `