code: function (html, length, options) {
      helper.setup(length, options);
      if (!html ||
          isNaN(helper.limit) ||
          helper.limit <= 0 ||
          helper.limit === Infinity) {
          return html;
      }
      // if (helper.limit)
      var $;
      // support provied cheerio
      if (isCheerioInstance(html)) {
          $ = html;
      }
      else {
          // Add a wrapper for text node without tag like:
          //   <p>Lorem ipsum <p>dolor sit => <div><p>Lorem ipsum <p>dolor sit</div>
          $ = load(("" + html), {
              decodeEntities: helper.options.decodeEntities
          });
      }
      var $html = $.root();
      // remove excludes elements
      helper.options.excludes && $html.find(helper.options.excludes).remove();
      // strip tags and get pure text
      if (helper.options.stripTags) {
          return helper.truncate($html.text());
      }
      var travelChildren = function ($ele, isParentLastNode) {
          if ( isParentLastNode === void 0 ) isParentLastNode = true;
  
          var contents = $ele.contents();
          var lastIdx = contents.length - 1;
          return contents.each(function (idx) {
              switch (this.type) {
                  case 'text':
                      if (!helper.limit) {
                          $(this).remove();
                          return;
                      }
                      this.data = helper.truncate($(this).text(), isParentLastNode && idx === lastIdx);
                      break;
                  case 'tag':
                      if (!helper.limit) {
                          $(this).remove();
                      }
                      else {
                          return travelChildren($(this), isParentLastNode && idx === lastIdx);
                      }
                      break;
                  default:
                      // for comments
                      return $(this).remove();
              }
          });
      };
      travelChildren($html);
      return $html.html();
  }
docs: truncate html
  @method truncate(html, [length], [options])
  @param  {String}         html    html string to truncate
  @param  {Object|number}  length how many letters(words if `byWords` is true) you want reserve
  @param  {Object|null}    options
  @return {String}