code: function createHead(ast) {
    var thead = { type: 'thead', nodes: [] };
    define(thead, 'parent', ast);
  
    if (ast.nodes.length === 3) {
      var text = { type: 'text', val: '' };
      var th = { type: 'th', attribs: { align: 'center'}, nodes: [text] };
      define(text, 'parent', th);
      define(th, 'parent', thead);
      thead.nodes.push(th);
      util.wrapNodes(th, Node);
      util.wrapNodes(thead, Node);
      ast.nodes.splice(1, 0, thead);
      return ast;
    }
  
    for (var i = 0; i < ast.nodes.length; i++) {
      var node = ast.nodes[i];
      if (node.nodes && util.hasType(node, 'th')) {
        define(node, 'parent', thead);
        thead.nodes.push(node);
        util.wrapNodes(thead, Node);
        ast.nodes[i] = thead;
        break;
      }
    }
  
    return ast;
  }
docs: Add `thead` nodes if they don't exist