docs: function combineTextAndInline(nodes) {
    return nodes.reduce((acc, node) => {
      const prevNode = last(acc);
      const prevNodeLeaves = get(prevNode, 'leaves');
      const data = node.data || {};
  
      /**
       * If the previous node has leaves and the current node has marks in data
       * (only happens when we place them on inline nodes here in the parser), or
       * the current node also has leaves (because the previous node was
       * originally an inline node that we've already squashed into a leaf)
       * combine the current node into the previous.
       */
      if (!isEmpty(prevNodeLeaves) && !isEmpty(data.marks)) {
        prevNodeLeaves.push({ node, marks: data.marks });
        return acc;
      }
  
      if (!isEmpty(prevNodeLeaves) && !isEmpty(node.leaves)) {
        prevNode.leaves = prevNodeLeaves.concat(node.leaves);
        return acc;
      }
  
      /**
       * Break nodes contain a single child text node with a newline character
       * for visual purposes in the editor, but Remark break nodes have no
       * children, so we remove the child node here.
       */
      if (node.type === 'break') {
        acc.push({ object: 'inline', type: 'break' });
        return acc;
      }
  
      /**
       * Convert remaining inline nodes to standalone text nodes with leaves.
       */
      if (node.object === 'inline') {
        acc.push({ object: 'text', leaves: [{ node, marks: data.marks }] });
        return acc;
      }
  
      /**
       * Only remaining case is an actual text node, can be pushed as is.
       */
      acc.push(node);
      return acc;
    }, []);
  }