docs: function(args) {
      var mode = (args && args['mode']) || 'update';
      return map(function(code, filename) {
          var lines = code.toString().split("\n");
          var gists = {};
          var currentGist = null;
          var lineNo = 0;
          lines.forEach(function(line) {
              if (line.indexOf("// startgist:") > -1 || line.indexOf("# startgist:") > -1) {
                  if (currentGist) {
                      throw new PluginError(PLUGIN_NAME, filename + ":" + lineNo + ": Unexpected startgist: a previous gist was not closed");
                  }
                  currentGist = {
                      "id": line.split(":")[1].trim(),
                      "filename": line.split(":")[2].trim(),
                      "lines": []
                  };
              } else if (line.indexOf("// endgist") > -1 || line.indexOf("# endgist") > -1) {
                  if (!currentGist) {
                      throw new PluginError(PLUGIN_NAME, filename + ":" + lineNo + " Unexpected endgist: missing startgist earlier");
                  }
                  if (!gists[currentGist.id]) {
                      gists[currentGist.id] = {};
                  }
                  gists[currentGist.id][currentGist.filename] = {
                      'content': leftAlign(currentGist.lines).join("\n")
                  };
                  currentGist = null;
              } else if (currentGist && line.indexOf("gisthide") == -1) {
                  currentGist.lines.push(line);
              }
              lineNo += 1;
          });
          if (currentGist) {
              throw new PluginError(PLUGIN_NAME, "Reached end of file but gist is still open");
          }
          if (mode == 'create') {
              return fs.read(getUserHome() + '/.gistauth', 'b').then(function (auth) {
                  return Q.all(Object.keys(gists).map(function(id) {
                      return create(auth, gists[id]);
                  }));
              }).done();
          } else if (mode == 'update') {
              return fs.read(getUserHome() + '/.gistauth', 'b').then(function (auth) {
                  return Q.all(Object.keys(gists).map(function(id) {
                      return patch(auth, id, gists[id]);
                  }));
              }).done();
          } else {
              gutil.log('Gist mock: ', gists);
          }
      });
  }