def parent_for(heading)
      heading = heading[1].to_i if heading.is_a?(String)
      if children.any? && children.last.level < heading
        children.last.parent_for(heading)
      else
        self
      end
    end
def parent_for(heading)
      heading = heading[1].to_i if heading.is_a?(String)
      if children.any? && children.last.level < heading
        children.last.parent_for(heading)
      else
        self
      end
    end
Returns the appropriate TocItem for appending a new item
 at a particular heading level.