code: function pushTextNode(list, html, level, start, ignoreWhitespace) {
      // calculate correct end of the content slice in case there's
      // no tag after the text node.
      var end = html.indexOf('<', start);
      var content = html.slice(start, end === -1 ? undefined : end); // if a node is nothing but whitespace, collapse it as the spec states:
      // https://www.w3.org/TR/html4/struct/text.html#h-9.1
  
      if (/^\s*$/.test(content)) {
        content = ' ';
      } // don't add whitespace-only text nodes if they would be trailing text nodes
      // or if they would be leading whitespace-only text nodes:
      //  * end > -1 indicates this is not a trailing text node
      //  * leading node is when level is -1 and list has length 0
  
  
      if (!ignoreWhitespace && end > -1 && level + list.length >= 0 || content !== ' ') {
        list.push({
          type: 'text',
          content: content
        });
      }
    }
docs: common logic for pushing a child node onto a list