How to use docco - 8 common examples

To help you get started, we’ve selected a few docco examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github btford / socketron / gen-docs.js View on Github external
if (toHighlight.hasOwnProperty(id)) {
      highlight(toHighlight[id], function (output) {
        readme = readme.replace('//js:' + id, output);
        delete toHighlight[id];
        highlightSnippets();
      });
      return;
    }
  }
  writeIndex();
};

highlightSnippets();

// run docco for libs
require('docco').run([
  '', '',
  '--css',      'site/main.css',
  '--template', 'site/docco.jst',
  'lib/*.js']);

// run docco for unit tests
require('docco').run([
  '', '',
  '--css',      'site/main.css',
  '--template', 'site/docco.jst',
  '--output',   'docs/test/',
  'test/*.js']);
github canjs / canjs / build / tasks / docco.js View on Github external
var options = grunt.config(['docco', this.target]);
		var defaults = _.extend({
			exclude : [/\.min\./]
		}, grunt.config('strip')._options);
		grunt.verbose.writeflags(options, 'Options');
		var done = this.async();
		var src = grunt.file.expandFiles(this.file.src).filter(function(file) {
			for(var i = 0; i < defaults.exclude.length; i++) {
				if(defaults.exclude[i].test(file)) {
					return false;
				}
			}
			return true;
		});

		docco.document(src, options.docco || {}, function(err, result, code){
			grunt.log.writeln("Doccoed [" + src.join(", ") + "]; " + err ? err : "(No errors)" + "\n" + result + " " + code);
			done();
		});
	});
}
github donejs / donejs / build / tasks / docco.js View on Github external
var options = grunt.config.process(['docco', this.target]);
		var defaults = _.extend({
			exclude : [/\.min\./]
		}, grunt.config.process('docco')._options);
		grunt.verbose.writeflags(options, 'Options');
		var done = this.async();
		var src = grunt.file.expandFiles(this.file.src).filter(function(file) {
			for(var i = 0; i < defaults.exclude.length; i++) {
				if(defaults.exclude[i].test(file)) {
					return false;
				}
			}
			return true;
		});

		docco.document(src, _.extend({}, defaults.docco, options.docco) || {}, function(err, result, code){
			grunt.log.writeln("Doccoed [" + src.join(", ") + "]; " + err ? err : "(No errors)" + "\n" + result + " " + code);
			done();
		});
	});
}
github jilieryuyi / wing-binlog / web / vendors / parsleyjs / gulpfile.babel.js View on Github external
function buildDoc(done) {
  var dest = 'doc/annotated-source/';
  var sources = glob.sync('src/parsley/*.js');
  del.sync([dest + '*']);
  docco.document({
    layout: 'parallel',
    output: dest,
    args: sources
  }, function() {
      gulp.src(dest + '*.html', { base: "./" })
      .pipe($.replace('<div id="jump_page">', '<div id="jump_page"><a href="../index.html" class="source">&lt;&lt;&lt; back to documentation</a>'))
      .pipe($.replace('', ''))
      .pipe(gulp.dest('.'))
      .on('end', done);
  });
}

</div></div>
github AlphaHydrae / docco-central / lib / generator.js View on Github external
document : function(menu, callback) {
    docco.document(this.doccoFiles(), this.doccoOptions(), function() {
      callback(undefined, menu);
    });
  },
github stackfull / angular-virtual-scroll / Gruntfile.js View on Github external
this.files.forEach(function(file) {
        docco.document(task.options({ output: file.dest, args: file.src }), function(){
          if(++fdone === flength){
            done();
          }
        });
      });
    });
github guillaumepotier / Parsley.js / gulpfile.babel.js View on Github external
function buildDoc(done) {
  var dest = 'doc/annotated-source/';
  var sources = glob.sync('src/parsley/*.js');
  del.sync([dest + '*']);
  docco.document({
    layout: 'parallel',
    output: dest,
    args: sources
  }, function() {
      gulp.src(dest + '*.html', { base: "./" })
      .pipe($.replace('<div id="jump_page">', '<div id="jump_page"><a href="../index.html" class="source">&lt;&lt;&lt; back to documentation</a>'))
      .pipe($.replace('', ''))
      .pipe(gulp.dest('.'))
      .on('end', done);
  });
}
</div></div>
github mozilla / togetherjs / Gruntfile.js View on Github external
sources.forEach(function (source) {
      var sourceName = source.replace(/\.js$/, "");
      var dest = grunt.option("dest") + "/source/" + source + ".html";
      grunt.log.writeln("Rendering " + source.cyan + " to " + dest.cyan);
      var code = grunt.file.read("togetherjs/" + source);
      var sections = docco.parse(source, code, {languages:{}});
      doccoFormat(source, sections);
      sections.forEach(function (section, i) {
        section.index = i;
        section.empty = section.codeText.replace(/\s/gm, "") === "";
      });
      var first = marked.lexer(sections[0].docsText)[0];
      var hasTitle = first && first.type == 'heading' && first.depth == 1;
      var title = hasTitle ? first.text : path.basename(source, ".js");
      var tmpl = env.getTemplate("source-code.tmpl");
      var tmplVars = Object.create(vars);
      tmplVars.title = title;
      tmplVars.sections = sections;
      tmplVars.source = source;
      tmplVars.sourceName = sourceName;
      tmplVars.sourceDescription = marked(sourceDescriptions[sourceName] || "", {smartypants: true});
      tmplVars.base = "../";

docco

The Quick and Dirty Literate Programming Documentation Generator

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Popular docco functions