function generate(fp, options) {
  options = options || {};
  fp = path.join(options.cwd || process.cwd(), fp);
  var str = fs.readFileSync(fp, 'utf8');
  var first = str.split('\n')[0].trim().slice(2).trim();

  // don't generate a TOC for a template
  if (/\{%=/.test(first)) return '';
  var res = '';

  res += mdu.h2(mdu.link(first, relative(fp)));
  res += '__AFTER__';
  res += '\n';

  var table = toc(str, {
    linkify: function(tok, heading) {
      var url = relative(fp);
      url += '/#';
      url += toc.slugify(heading);
      tok.content = mdu.link(tok.content, url);
      return tok;
    }
  });

  res += table.content;
  res += '\n';

  res = res.split(/\n{2,}/).join('\n');
  res = res.split('__AFTER__').join('\n');
  return res;
}
Generate a Table of Contents for a glob of files.