├── .gitignore ├── .npmignore ├── Cakefile ├── LICENSE ├── README ├── bin └── docco ├── docco.js ├── docco.litcoffee ├── index.html ├── package-lock.json ├── package.json └── resources ├── classic ├── docco.css ├── docco.jst └── public │ ├── fonts │ ├── aller-bold.eot │ ├── aller-bold.ttf │ ├── aller-bold.woff │ ├── aller-light.eot │ ├── aller-light.ttf │ ├── aller-light.woff │ ├── fleurons.eot │ ├── fleurons.ttf │ ├── fleurons.woff │ ├── roboto-black.eot │ ├── roboto-black.ttf │ └── roboto-black.woff │ ├── images │ └── gray.png │ └── stylesheets │ └── normalize.css ├── languages.json ├── linear ├── docco.css ├── docco.jst └── public │ ├── fonts │ ├── aller-bold.eot │ ├── aller-bold.ttf │ ├── aller-bold.woff │ ├── aller-light.eot │ ├── aller-light.ttf │ ├── aller-light.woff │ ├── fleurons.eot │ ├── fleurons.ttf │ ├── fleurons.woff │ ├── roboto-black.eot │ ├── roboto-black.ttf │ └── roboto-black.woff │ ├── images │ └── gray.png │ └── stylesheets │ └── normalize.css ├── parallel ├── docco.css ├── docco.jst └── public │ ├── fonts │ ├── aller-bold.eot │ ├── aller-bold.ttf │ ├── aller-bold.woff │ ├── aller-light.eot │ ├── aller-light.ttf │ ├── aller-light.woff │ ├── roboto-black.eot │ ├── roboto-black.ttf │ └── roboto-black.woff │ └── stylesheets │ └── normalize.css └── plain-markdown ├── README.md └── docco.jst /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | output 3 | docs 4 | node_modules 5 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .git* 3 | Cakefile 4 | docco.litcoffee 5 | index.html 6 | -------------------------------------------------------------------------------- /Cakefile: -------------------------------------------------------------------------------- 1 | {spawn, exec} = require 'child_process' 2 | fs = require 'fs' 3 | path = require 'path' 4 | 5 | option '-p', '--prefix [DIR]', 'set the installation prefix for `cake install`' 6 | option '-w', '--watch', 'continually build the docco library' 7 | option '-l', '--layout [LAYOUT]', 'specify the layout for Docco\'s docs' 8 | 9 | task 'build', 'build the docco library', (options) -> 10 | coffee = spawn 'coffee', ['-c' + (if options.watch then 'w' else ''), '.'] 11 | coffee.stdout.on 'data', (data) -> console.log data.toString().trim() 12 | coffee.stderr.on 'data', (data) -> console.log data.toString().trim() 13 | 14 | task 'install', 'install the `docco` command into /usr/local (or --prefix)', (options) -> 15 | base = options.prefix or '/usr/local' 16 | lib = base + '/lib/docco' 17 | exec([ 18 | 'mkdir -p ' + lib + ' ' + base + '/bin' 19 | 'cp -rf bin README resources ' + lib 20 | 'ln -sf ' + lib + '/bin/docco ' + base + '/bin/docco' 21 | ].join(' && '), (err, stdout, stderr) -> 22 | if err then console.error stderr 23 | ) 24 | 25 | task 'doc', 'rebuild the Docco documentation', (options) -> 26 | layout = options.layout or 'linear' 27 | exec([ 28 | "bin/docco --layout #{layout} docco.litcoffee" 29 | "sed \"s/docco.css/resources\\/#{layout}\\/docco.css/\" < docs/docco.html > index.html" 30 | 'rm -r docs' 31 | ].join(' && '), (err) -> 32 | throw err if err 33 | ) 34 | 35 | task 'loc', 'count the lines of code in Docco', -> 36 | code = fs.readFileSync('docco.litcoffee').toString() 37 | lines = code.split('\n').filter (line) -> /^ /.test line 38 | console.log "Docco LOC: #{lines.length}" 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The Lil License v1 2 | 3 | Copyright (c) 2009-2025 Jeremy Ashkenas 4 | 5 | Permission is hereby granted by the authors of this software, to any person, 6 | to use the software for any purpose, free of charge, including the rights 7 | to run, read, copy, change, distribute and sell it, and including usage rights 8 | to any patents the authors may hold on it, subject to the following conditions: 9 | 10 | This license, or a link to its text, must be included with all copies of 11 | the software and any derivative works. 12 | 13 | Any modification to the software submitted to the authors may be incorporated 14 | into the software under the terms of this license. 15 | 16 | The software is provided "as is", without warranty of any kind, including 17 | but not limited to the warranties of title, fitness, merchantability and 18 | non-infringement. The authors have no obligation to provide support or updates 19 | for the software, and may not be held liable for any damages, claims or other 20 | liability arising from its use. 21 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | ____ 2 | /\ _`\ 3 | \ \ \/\ \ ___ ___ ___ ___ 4 | \ \ \ \ \ / __`\ /'___\ /'___\ / __`\ 5 | \ \ \_\ \ /\ \ \ \ /\ \__/ /\ \__/ /\ \ \ \ 6 | \ \____/ \ \____/ \ \____\ \ \____\ \ \____/ 7 | \/___/ \/___/ \/____/ \/____/ \/___/ 8 | 9 | 10 | Docco is a quick-and-dirty, hundred-line-long, literate-programming-style 11 | documentation generator. For more information, see: 12 | 13 | http://ashkenas.com/docco/ 14 | 15 | Installation: 16 | 17 | sudo npm install -g docco 18 | 19 | Usage: docco [options] FILES 20 | 21 | Options: 22 | 23 | -h, --help output usage information 24 | -V, --version output the version number 25 | -l, --layout [layout] choose a built-in layouts (parallel, linear) 26 | -c, --css [file] use a custom css file 27 | -o, --output [path] use a custom output path 28 | -t, --template [file] use a custom .jst template 29 | -e, --extension [ext] use the given file extension for all inputs 30 | -L, --languages [file] use a custom languages.json 31 | -m, --marked [file] use custom marked options 32 | -------------------------------------------------------------------------------- /bin/docco: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var path = require('path'); 4 | var fs = require('fs'); 5 | var dir = path.join(path.dirname(fs.realpathSync(__filename)), '../'); 6 | require(dir + 'docco.js').run(); 7 | -------------------------------------------------------------------------------- /docco.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 2.7.0 2 | (function() { 3 | // Docco 4 | // ===== 5 | 6 | // **Docco** is a quick-and-dirty documentation generator, written in 7 | // [Literate CoffeeScript](http://coffeescript.org/#literate). 8 | // It produces an HTML document that displays your comments intermingled with your 9 | // code. All prose is passed through 10 | // [Markdown](http://daringfireball.net/projects/markdown/syntax), and code is 11 | // passed through [Highlight.js](http://highlightjs.org/) syntax highlighting. 12 | // This page is the result of running Docco against its own 13 | // [source file](https://github.com/jashkenas/docco/blob/master/docco.litcoffee). 14 | 15 | // 1. Install Docco with **npm**: `sudo npm install -g docco` 16 | 17 | // 2. Run it against your code: `docco src/*.coffee` 18 | 19 | // There is no "Step 3". This will generate an HTML page for each of the named 20 | // source files, with a menu linking to the other pages, saving the whole mess 21 | // into a `docs` folder (configurable). 22 | 23 | // The [Docco source](http://github.com/jashkenas/docco) is available on GitHub, 24 | // and is released under the [Lil License](http://lillicense.org/v1.html). 25 | 26 | // Docco can be used to process code written in any programming language. If it 27 | // doesn't handle your favorite yet, feel free to 28 | // [add it to the list](https://github.com/jashkenas/docco/blob/master/resources/languages.json). 29 | // Finally, the ["literate" style](http://coffeescript.org/#literate) of *any* 30 | // language listed in [languages.json](https://github.com/jashkenas/docco/blob/master/resources/languages.json) 31 | // is also supported — just tack an `.md` extension on the end: 32 | // `.coffee.md`, `.py.md`, and so on. 33 | 34 | // Partners in Crime: 35 | // ------------------ 36 | 37 | // * If Node.js doesn't run on your platform, or you'd prefer a more 38 | // convenient package, get [Ryan Tomayko](http://github.com/rtomayko)'s 39 | // [Rocco](http://rtomayko.github.io/rocco/rocco.html), the **Ruby** port that's 40 | // available as a gem. 41 | 42 | // * If you're writing shell scripts, try 43 | // [Shocco](http://rtomayko.github.io/shocco/), a port for the **POSIX shell**, 44 | // also by Mr. Tomayko. 45 | 46 | // * If **Python** is more your speed, take a look at 47 | // [Nick Fitzgerald](http://github.com/fitzgen)'s [Pycco](https://pycco-docs.github.io/pycco/). 48 | 49 | // * For **Clojure** fans, [Fogus](http://blog.fogus.me/)'s 50 | // [Marginalia](http://fogus.me/fun/marginalia/) is a bit of a departure from 51 | // "quick-and-dirty", but it'll get the job done. 52 | 53 | // * There's a **Go** port called [Gocco](http://nikhilm.github.io/gocco/), 54 | // written by [Nikhil Marathe](https://github.com/nikhilm). 55 | 56 | // * For all you **PHP** buffs out there, Fredi Bach's 57 | // [sourceMakeup](http://jquery-jkit.com/sourcemakeup/) (we'll let the faux pas 58 | // with respect to our naming scheme slide), should do the trick nicely. 59 | 60 | // * **Lua** enthusiasts can get their fix with 61 | // [Robert Gieseke](https://github.com/rgieseke)'s [Locco](http://rgieseke.github.io/locco/). 62 | 63 | // * And if you happen to be a **.NET** 64 | // aficionado, check out [Don Wilson](https://github.com/dontangg)'s 65 | // [Nocco](http://dontangg.github.io/nocco/). 66 | 67 | // * Going further afield from the quick-and-dirty, [Groc](http://nevir.github.io/groc/) 68 | // is a **CoffeeScript** fork of Docco that adds a searchable table of contents, 69 | // and aims to gracefully handle large projects with complex hierarchies of code. 70 | 71 | // * For **ES6** fans, [Docco Next](https://github.com/mobily-enterprises/docco-next) 72 | // is an expanded rewrite of Docco in modern JavaScript, thoroughly commented, 73 | // and with the bonus that your existing templates will still work. 74 | 75 | // Note that not all ports support all Docco features. 76 | 77 | // Main Documentation Generation Functions 78 | // --------------------------------------- 79 | 80 | // Generate the documentation for our configured source file by copying over static 81 | // assets, reading all the source files in, splitting them up into prose+code 82 | // sections, highlighting each file in the appropriate language, and printing them 83 | // out in an HTML template. 84 | var Docco, _, buildMatchers, commander, configure, defaults, document, format, fs, getLanguage, highlightjs, languages, marked, parse, path, run, version, write; 85 | 86 | document = function(options = {}, callback) { 87 | var config; 88 | config = configure(options); 89 | return fs.mkdirs(config.output, function() { 90 | var complete, copyAsset, files, nextFile; 91 | callback || (callback = function(error) { 92 | if (error) { 93 | throw error; 94 | } 95 | }); 96 | copyAsset = function(file, callback) { 97 | if (!fs.existsSync(file)) { 98 | return callback(); 99 | } 100 | return fs.copy(file, path.join(config.output, path.basename(file)), callback); 101 | }; 102 | complete = function() { 103 | return copyAsset(config.css, function(error) { 104 | if (error) { 105 | return callback(error); 106 | } 107 | if (fs.existsSync(config.public)) { 108 | return copyAsset(config.public, callback); 109 | } 110 | return callback(); 111 | }); 112 | }; 113 | files = config.sources.slice(); 114 | nextFile = function() { 115 | var source; 116 | source = files.shift(); 117 | return fs.readFile(source, function(error, buffer) { 118 | var code, sections; 119 | if (error) { 120 | return callback(error); 121 | } 122 | code = buffer.toString(); 123 | sections = parse(source, code, config); 124 | format(source, sections, config); 125 | write(source, sections, config); 126 | if (files.length) { 127 | return nextFile(); 128 | } else { 129 | return complete(); 130 | } 131 | }); 132 | }; 133 | return nextFile(); 134 | }); 135 | }; 136 | 137 | // Given a string of source code, **parse** out each block of prose and the code that 138 | // follows it — by detecting which is which, line by line — and then create an 139 | // individual **section** for it. Each section is an object with `docsText` and 140 | // `codeText` properties, and eventually `docsHtml` and `codeHtml` as well. 141 | parse = function(source, code, config = {}) { 142 | var codeText, docsText, hasCode, i, isText, j, k, lang, len, len1, line, lines, match, maybeCode, save, sections; 143 | lines = code.split('\n'); 144 | sections = []; 145 | lang = getLanguage(source, config); 146 | hasCode = docsText = codeText = ''; 147 | save = function() { 148 | sections.push({docsText, codeText}); 149 | return hasCode = docsText = codeText = ''; 150 | }; 151 | // Our quick-and-dirty implementation of the literate programming style. Simply 152 | // invert the prose and code relationship on a per-line basis, and then continue as 153 | // normal below. 154 | if (lang.literate) { 155 | isText = maybeCode = true; 156 | for (i = j = 0, len = lines.length; j < len; i = ++j) { 157 | line = lines[i]; 158 | lines[i] = maybeCode && (match = /^([ ]{4}|[ ]{0,3}\t)/.exec(line)) ? (isText = false, line.slice(match[0].length)) : (maybeCode = /^\s*$/.test(line)) ? isText ? lang.symbol : '' : (isText = true, lang.symbol + ' ' + line); 159 | } 160 | } 161 | for (k = 0, len1 = lines.length; k < len1; k++) { 162 | line = lines[k]; 163 | if (line.match(lang.commentMatcher) && !line.match(lang.commentFilter)) { 164 | if (hasCode) { 165 | save(); 166 | } 167 | docsText += (line = line.replace(lang.commentMatcher, '')) + '\n'; 168 | if (/^(---+|===+)$/.test(line)) { 169 | save(); 170 | } 171 | } else { 172 | hasCode = true; 173 | codeText += line + '\n'; 174 | } 175 | } 176 | save(); 177 | return sections; 178 | }; 179 | 180 | // To **format** and highlight the now-parsed sections of code, we use **Highlight.js** 181 | // over stdio, and run the text of their corresponding comments through 182 | // **Markdown**, using [Marked](https://github.com/chjj/marked). 183 | format = function(source, sections, config) { 184 | var code, i, j, language, len, markedOptions, results, section; 185 | language = getLanguage(source, config); 186 | // Pass any user defined options to Marked if specified via command line option 187 | markedOptions = { 188 | smartypants: true 189 | }; 190 | if (config.marked) { 191 | markedOptions = config.marked; 192 | } 193 | marked.setOptions(markedOptions); 194 | // Tell Marked how to highlight code blocks within comments, treating that code 195 | // as either the language specified in the code block or the language of the file 196 | // if not specified. 197 | marked.setOptions({ 198 | highlight: function(code, lang) { 199 | lang || (lang = language.name); 200 | if (highlightjs.getLanguage(lang)) { 201 | return highlightjs.highlight(code, { 202 | language: lang 203 | }).value; 204 | } else { 205 | console.warn(`docco: couldn't highlight code block with unknown language '${lang}' in ${source}`); 206 | return code; 207 | } 208 | } 209 | }); 210 | results = []; 211 | for (i = j = 0, len = sections.length; j < len; i = ++j) { 212 | section = sections[i]; 213 | code = highlightjs.highlight(section.codeText, { 214 | language: language.name 215 | }).value; 216 | code = code.replace(/\s+$/, ''); 217 | section.codeHtml = `
${code}
`; 218 | results.push(section.docsHtml = marked(section.docsText)); 219 | } 220 | return results; 221 | }; 222 | 223 | // Once all of the code has finished highlighting, we can **write** the resulting 224 | // documentation file by passing the completed HTML sections into the template, 225 | // and rendering it to the specified output path. 226 | write = function(source, sections, config) { 227 | var css, destination, first, firstSection, hasTitle, html, relative, title; 228 | destination = function(file) { 229 | return path.join(config.output, path.dirname(file), path.basename(file, path.extname(file)) + '.html'); 230 | }; 231 | relative = function(file) { 232 | var from, to; 233 | to = path.dirname(path.resolve(file)); 234 | from = path.dirname(path.resolve(destination(source))); 235 | return path.join(path.relative(from, to), path.basename(file)); 236 | }; 237 | // The **title** of the file is either the first heading in the prose, or the 238 | // name of the source file. 239 | firstSection = _.find(sections, function(section) { 240 | return section.docsText.length > 0; 241 | }); 242 | if (firstSection) { 243 | first = marked.lexer(firstSection.docsText)[0]; 244 | } 245 | hasTitle = first && first.type === 'heading' && first.depth === 1; 246 | title = hasTitle ? first.text : path.basename(source); 247 | css = relative(path.join(config.output, path.basename(config.css))); 248 | html = config.template({ 249 | sources: config.sources, 250 | css, 251 | title, 252 | hasTitle, 253 | sections, 254 | path, 255 | destination, 256 | relative 257 | }); 258 | console.log(`docco: ${source} -> ${destination(source)}`); 259 | return fs.outputFileSync(destination(source), html); 260 | }; 261 | 262 | // Configuration 263 | // ------------- 264 | 265 | // Default configuration **options**. All of these may be extended by 266 | // user-specified options. 267 | defaults = { 268 | layout: 'parallel', 269 | output: 'docs', 270 | template: null, 271 | css: null, 272 | extension: null, 273 | languages: {}, 274 | marked: null 275 | }; 276 | 277 | // **Configure** this particular run of Docco. We might use a passed-in external 278 | // template, or one of the built-in **layouts**. We only attempt to process 279 | // source files for languages for which we have definitions. 280 | configure = function(options) { 281 | var config, dir; 282 | config = _.extend({}, defaults, _.pick(options.opts(), ..._.keys(defaults))); 283 | config.languages = buildMatchers(config.languages); 284 | // The user is able to override the layout file used with the `--template` parameter. 285 | // In this case, it is also neccessary to explicitly specify a stylesheet file. 286 | // These custom templates are compiled exactly like the predefined ones, but the `public` folder 287 | // is only copied for the latter. 288 | if (config.template) { 289 | if (!config.css) { 290 | console.warn("docco: no stylesheet file specified"); 291 | } 292 | config.layout = null; 293 | } else { 294 | dir = config.layout = path.join(__dirname, 'resources', config.layout); 295 | if (fs.existsSync(path.join(dir, 'public'))) { 296 | config.public = path.join(dir, 'public'); 297 | } 298 | config.template = path.join(dir, 'docco.jst'); 299 | config.css = options.css || path.join(dir, 'docco.css'); 300 | } 301 | config.template = _.template(fs.readFileSync(config.template).toString()); 302 | if (options.marked) { 303 | config.marked = JSON.parse(fs.readFileSync(options.marked)); 304 | } 305 | config.sources = options.args.filter(function(source) { 306 | var lang; 307 | lang = getLanguage(source, config); 308 | if (!lang) { 309 | console.warn(`docco: skipped unknown type (${path.basename(source)})`); 310 | } 311 | return lang; 312 | }).sort(); 313 | return config; 314 | }; 315 | 316 | // Helpers & Initial Setup 317 | // ----------------------- 318 | 319 | // Require our external dependencies. 320 | _ = require('underscore'); 321 | 322 | fs = require('fs-extra'); 323 | 324 | path = require('path'); 325 | 326 | marked = require('marked').marked; 327 | 328 | commander = require('commander'); 329 | 330 | highlightjs = require('highlight.js'); 331 | 332 | // Languages are stored in JSON in the file `resources/languages.json`. 333 | // Each item maps the file extension to the name of the language and the 334 | // `symbol` that indicates a line comment. To add support for a new programming 335 | // language to Docco, just add it to the file. 336 | languages = JSON.parse(fs.readFileSync(path.join(__dirname, 'resources', 'languages.json'))); 337 | 338 | // Build out the appropriate matchers and delimiters for each language. 339 | buildMatchers = function(languages) { 340 | var ext, l; 341 | for (ext in languages) { 342 | l = languages[ext]; 343 | // Does the line begin with a comment? 344 | l.commentMatcher = RegExp(`^\\s*${l.symbol}\\s?`); 345 | // Ignore [hashbangs](http://en.wikipedia.org/wiki/Shebang_%28Unix%29) and interpolations... 346 | l.commentFilter = /(^#![\/]|^\s*#\{)/; 347 | } 348 | return languages; 349 | }; 350 | 351 | languages = buildMatchers(languages); 352 | 353 | // A function to get the current language we're documenting, based on the 354 | // file extension. Detect and tag "literate" `.ext.md` variants. 355 | getLanguage = function(source, config) { 356 | var codeExt, codeLang, ext, lang, ref, ref1; 357 | ext = config.extension || path.extname(source) || path.basename(source); 358 | lang = ((ref = config.languages) != null ? ref[ext] : void 0) || languages[ext]; 359 | if (lang && lang.name === 'markdown') { 360 | codeExt = path.extname(path.basename(source, ext)); 361 | codeLang = ((ref1 = config.languages) != null ? ref1[codeExt] : void 0) || languages[codeExt]; 362 | if (codeExt && codeLang) { 363 | lang = _.extend({}, codeLang, { 364 | literate: true 365 | }); 366 | } 367 | } 368 | return lang; 369 | }; 370 | 371 | // Keep it DRY. Extract the docco **version** from `package.json` 372 | version = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'))).version; 373 | 374 | // Command Line Interface 375 | // ---------------------- 376 | 377 | // Finally, let's define the interface to run Docco from the command line. 378 | // Parse options using [Commander](https://github.com/visionmedia/commander.js). 379 | run = function(args = process.argv) { 380 | var c; 381 | c = defaults; 382 | commander.version(version).usage('[options] files').option('-L, --languages [file]', 'use a custom languages.json', _.compose(JSON.parse, fs.readFileSync)).option('-l, --layout [name]', 'choose a layout (parallel, linear or classic)', c.layout).option('-o, --output [path]', 'output to a given folder', c.output).option('-c, --css [file]', 'use a custom css file', c.css).option('-t, --template [file]', 'use a custom .jst template', c.template).option('-e, --extension [ext]', 'assume a file extension for all inputs', c.extension).option('-m, --marked [file]', 'use custom marked options', c.marked).parse(args).name = "docco"; 383 | if (commander.args.length) { 384 | return document(commander); 385 | } else { 386 | return console.log(commander.helpInformation()); 387 | } 388 | }; 389 | 390 | // Public API 391 | // ---------- 392 | Docco = module.exports = {run, document, parse, format, version}; 393 | 394 | }).call(this); 395 | -------------------------------------------------------------------------------- /docco.litcoffee: -------------------------------------------------------------------------------- 1 | Docco 2 | ===== 3 | 4 | **Docco** is a quick-and-dirty documentation generator, written in 5 | [Literate CoffeeScript](http://coffeescript.org/#literate). 6 | It produces an HTML document that displays your comments intermingled with your 7 | code. All prose is passed through 8 | [Markdown](http://daringfireball.net/projects/markdown/syntax), and code is 9 | passed through [Highlight.js](http://highlightjs.org/) syntax highlighting. 10 | This page is the result of running Docco against its own 11 | [source file](https://github.com/jashkenas/docco/blob/master/docco.litcoffee). 12 | 13 | 1. Install Docco with **npm**: `sudo npm install -g docco` 14 | 15 | 2. Run it against your code: `docco src/*.coffee` 16 | 17 | There is no "Step 3". This will generate an HTML page for each of the named 18 | source files, with a menu linking to the other pages, saving the whole mess 19 | into a `docs` folder (configurable). 20 | 21 | The [Docco source](http://github.com/jashkenas/docco) is available on GitHub, 22 | and is released under the [Lil License](http://lillicense.org/v1.html). 23 | 24 | Docco can be used to process code written in any programming language. If it 25 | doesn't handle your favorite yet, feel free to 26 | [add it to the list](https://github.com/jashkenas/docco/blob/master/resources/languages.json). 27 | Finally, the ["literate" style](http://coffeescript.org/#literate) of *any* 28 | language listed in [languages.json](https://github.com/jashkenas/docco/blob/master/resources/languages.json) 29 | is also supported — just tack an `.md` extension on the end: 30 | `.coffee.md`, `.py.md`, and so on. 31 | 32 | 33 | Partners in Crime: 34 | ------------------ 35 | 36 | * If Node.js doesn't run on your platform, or you'd prefer a more 37 | convenient package, get [Ryan Tomayko](http://github.com/rtomayko)'s 38 | [Rocco](http://rtomayko.github.io/rocco/rocco.html), the **Ruby** port that's 39 | available as a gem. 40 | 41 | * If you're writing shell scripts, try 42 | [Shocco](http://rtomayko.github.io/shocco/), a port for the **POSIX shell**, 43 | also by Mr. Tomayko. 44 | 45 | * If **Python** is more your speed, take a look at 46 | [Nick Fitzgerald](http://github.com/fitzgen)'s [Pycco](https://pycco-docs.github.io/pycco/). 47 | 48 | * For **Clojure** fans, [Fogus](http://blog.fogus.me/)'s 49 | [Marginalia](http://fogus.me/fun/marginalia/) is a bit of a departure from 50 | "quick-and-dirty", but it'll get the job done. 51 | 52 | * There's a **Go** port called [Gocco](http://nikhilm.github.io/gocco/), 53 | written by [Nikhil Marathe](https://github.com/nikhilm). 54 | 55 | * For all you **PHP** buffs out there, Fredi Bach's 56 | [sourceMakeup](http://jquery-jkit.com/sourcemakeup/) (we'll let the faux pas 57 | with respect to our naming scheme slide), should do the trick nicely. 58 | 59 | * **Lua** enthusiasts can get their fix with 60 | [Robert Gieseke](https://github.com/rgieseke)'s [Locco](http://rgieseke.github.io/locco/). 61 | 62 | * And if you happen to be a **.NET** 63 | aficionado, check out [Don Wilson](https://github.com/dontangg)'s 64 | [Nocco](http://dontangg.github.io/nocco/). 65 | 66 | * Going further afield from the quick-and-dirty, [Groc](http://nevir.github.io/groc/) 67 | is a **CoffeeScript** fork of Docco that adds a searchable table of contents, 68 | and aims to gracefully handle large projects with complex hierarchies of code. 69 | 70 | * For **ES6** fans, [Docco Next](https://github.com/mobily-enterprises/docco-next) 71 | is an expanded rewrite of Docco in modern JavaScript, thoroughly commented, 72 | and with the bonus that your existing templates will still work. 73 | 74 | Note that not all ports support all Docco features. 75 | 76 | 77 | Main Documentation Generation Functions 78 | --------------------------------------- 79 | 80 | Generate the documentation for our configured source file by copying over static 81 | assets, reading all the source files in, splitting them up into prose+code 82 | sections, highlighting each file in the appropriate language, and printing them 83 | out in an HTML template. 84 | 85 | document = (options = {}, callback) -> 86 | config = configure options 87 | 88 | fs.mkdirs config.output, -> 89 | 90 | callback or= (error) -> throw error if error 91 | copyAsset = (file, callback) -> 92 | return callback() unless fs.existsSync file 93 | fs.copy file, path.join(config.output, path.basename(file)), callback 94 | complete = -> 95 | copyAsset config.css, (error) -> 96 | return callback error if error 97 | return copyAsset config.public, callback if fs.existsSync config.public 98 | callback() 99 | 100 | files = config.sources.slice() 101 | 102 | nextFile = -> 103 | source = files.shift() 104 | fs.readFile source, (error, buffer) -> 105 | return callback error if error 106 | 107 | code = buffer.toString() 108 | sections = parse source, code, config 109 | format source, sections, config 110 | write source, sections, config 111 | if files.length then nextFile() else complete() 112 | 113 | nextFile() 114 | 115 | Given a string of source code, **parse** out each block of prose and the code that 116 | follows it — by detecting which is which, line by line — and then create an 117 | individual **section** for it. Each section is an object with `docsText` and 118 | `codeText` properties, and eventually `docsHtml` and `codeHtml` as well. 119 | 120 | parse = (source, code, config = {}) -> 121 | lines = code.split '\n' 122 | sections = [] 123 | lang = getLanguage source, config 124 | hasCode = docsText = codeText = '' 125 | 126 | save = -> 127 | sections.push {docsText, codeText} 128 | hasCode = docsText = codeText = '' 129 | 130 | Our quick-and-dirty implementation of the literate programming style. Simply 131 | invert the prose and code relationship on a per-line basis, and then continue as 132 | normal below. 133 | 134 | if lang.literate 135 | isText = maybeCode = yes 136 | for line, i in lines 137 | lines[i] = if maybeCode and match = /^([ ]{4}|[ ]{0,3}\t)/.exec line 138 | isText = no 139 | line[match[0].length..] 140 | else if maybeCode = /^\s*$/.test line 141 | if isText then lang.symbol else '' 142 | else 143 | isText = yes 144 | lang.symbol + ' ' + line 145 | 146 | for line in lines 147 | if line.match(lang.commentMatcher) and not line.match(lang.commentFilter) 148 | save() if hasCode 149 | docsText += (line = line.replace(lang.commentMatcher, '')) + '\n' 150 | save() if /^(---+|===+)$/.test line 151 | else 152 | hasCode = yes 153 | codeText += line + '\n' 154 | save() 155 | 156 | sections 157 | 158 | To **format** and highlight the now-parsed sections of code, we use **Highlight.js** 159 | over stdio, and run the text of their corresponding comments through 160 | **Markdown**, using [Marked](https://github.com/chjj/marked). 161 | 162 | format = (source, sections, config) -> 163 | language = getLanguage source, config 164 | 165 | Pass any user defined options to Marked if specified via command line option 166 | 167 | markedOptions = 168 | smartypants: true 169 | 170 | if config.marked 171 | markedOptions = config.marked 172 | 173 | marked.setOptions markedOptions 174 | 175 | Tell Marked how to highlight code blocks within comments, treating that code 176 | as either the language specified in the code block or the language of the file 177 | if not specified. 178 | 179 | marked.setOptions { 180 | highlight: (code, lang) -> 181 | lang or= language.name 182 | 183 | if highlightjs.getLanguage(lang) 184 | highlightjs.highlight(code, {language: lang}).value 185 | else 186 | console.warn "docco: couldn't highlight code block with unknown language '#{lang}' in #{source}" 187 | code 188 | } 189 | 190 | for section, i in sections 191 | code = highlightjs.highlight(section.codeText, {language: language.name}).value 192 | code = code.replace(/\s+$/, '') 193 | section.codeHtml = "
#{code}
" 194 | section.docsHtml = marked(section.docsText) 195 | 196 | Once all of the code has finished highlighting, we can **write** the resulting 197 | documentation file by passing the completed HTML sections into the template, 198 | and rendering it to the specified output path. 199 | 200 | write = (source, sections, config) -> 201 | 202 | destination = (file) -> 203 | path.join(config.output, path.dirname(file), path.basename(file, path.extname(file)) + '.html') 204 | 205 | relative = (file) -> 206 | to = path.dirname(path.resolve(file)) 207 | from = path.dirname(path.resolve(destination(source))) 208 | path.join(path.relative(from, to), path.basename(file)) 209 | 210 | The **title** of the file is either the first heading in the prose, or the 211 | name of the source file. 212 | 213 | firstSection = _.find sections, (section) -> 214 | section.docsText.length > 0 215 | first = marked.lexer(firstSection.docsText)[0] if firstSection 216 | hasTitle = first and first.type is 'heading' and first.depth is 1 217 | title = if hasTitle then first.text else path.basename source 218 | css = relative path.join(config.output, path.basename(config.css)) 219 | 220 | html = config.template {sources: config.sources, css, 221 | title, hasTitle, sections, path, destination, relative} 222 | 223 | console.log "docco: #{source} -> #{destination source}" 224 | fs.outputFileSync destination(source), html 225 | 226 | 227 | Configuration 228 | ------------- 229 | 230 | Default configuration **options**. All of these may be extended by 231 | user-specified options. 232 | 233 | defaults = 234 | layout: 'parallel' 235 | output: 'docs' 236 | template: null 237 | css: null 238 | extension: null 239 | languages: {} 240 | marked: null 241 | 242 | **Configure** this particular run of Docco. We might use a passed-in external 243 | template, or one of the built-in **layouts**. We only attempt to process 244 | source files for languages for which we have definitions. 245 | 246 | configure = (options) -> 247 | config = _.extend {}, defaults, _.pick(options.opts(), _.keys(defaults)...) 248 | 249 | config.languages = buildMatchers config.languages 250 | 251 | The user is able to override the layout file used with the `--template` parameter. 252 | In this case, it is also neccessary to explicitly specify a stylesheet file. 253 | These custom templates are compiled exactly like the predefined ones, but the `public` folder 254 | is only copied for the latter. 255 | 256 | if config.template 257 | unless config.css 258 | console.warn "docco: no stylesheet file specified" 259 | config.layout = null 260 | else 261 | dir = config.layout = path.join __dirname, 'resources', config.layout 262 | config.public = path.join dir, 'public' if fs.existsSync path.join dir, 'public' 263 | config.template = path.join dir, 'docco.jst' 264 | config.css = options.css or path.join dir, 'docco.css' 265 | config.template = _.template fs.readFileSync(config.template).toString() 266 | 267 | if options.marked 268 | config.marked = JSON.parse fs.readFileSync(options.marked) 269 | 270 | config.sources = options.args.filter((source) -> 271 | lang = getLanguage source, config 272 | console.warn "docco: skipped unknown type (#{path.basename source})" unless lang 273 | lang 274 | ).sort() 275 | 276 | config 277 | 278 | 279 | Helpers & Initial Setup 280 | ----------------------- 281 | 282 | Require our external dependencies. 283 | 284 | _ = require 'underscore' 285 | fs = require 'fs-extra' 286 | path = require 'path' 287 | marked = require('marked').marked 288 | commander = require 'commander' 289 | highlightjs = require 'highlight.js' 290 | 291 | Languages are stored in JSON in the file `resources/languages.json`. 292 | Each item maps the file extension to the name of the language and the 293 | `symbol` that indicates a line comment. To add support for a new programming 294 | language to Docco, just add it to the file. 295 | 296 | languages = JSON.parse fs.readFileSync(path.join(__dirname, 'resources', 'languages.json')) 297 | 298 | Build out the appropriate matchers and delimiters for each language. 299 | 300 | buildMatchers = (languages) -> 301 | for ext, l of languages 302 | 303 | Does the line begin with a comment? 304 | 305 | l.commentMatcher = ///^\s*#{l.symbol}\s?/// 306 | 307 | Ignore [hashbangs](http://en.wikipedia.org/wiki/Shebang_%28Unix%29) and interpolations... 308 | 309 | l.commentFilter = /(^#![/]|^\s*#\{)/ 310 | languages 311 | languages = buildMatchers languages 312 | 313 | A function to get the current language we're documenting, based on the 314 | file extension. Detect and tag "literate" `.ext.md` variants. 315 | 316 | getLanguage = (source, config) -> 317 | ext = config.extension or path.extname(source) or path.basename(source) 318 | lang = config.languages?[ext] or languages[ext] 319 | if lang and lang.name is 'markdown' 320 | codeExt = path.extname(path.basename(source, ext)) 321 | codeLang = config.languages?[codeExt] or languages[codeExt] 322 | if codeExt and codeLang 323 | lang = _.extend {}, codeLang, {literate: yes} 324 | lang 325 | 326 | Keep it DRY. Extract the docco **version** from `package.json` 327 | 328 | version = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'))).version 329 | 330 | 331 | Command Line Interface 332 | ---------------------- 333 | 334 | Finally, let's define the interface to run Docco from the command line. 335 | Parse options using [Commander](https://github.com/visionmedia/commander.js). 336 | 337 | run = (args = process.argv) -> 338 | c = defaults 339 | commander.version(version) 340 | .usage('[options] files') 341 | .option('-L, --languages [file]', 'use a custom languages.json', _.compose JSON.parse, fs.readFileSync) 342 | .option('-l, --layout [name]', 'choose a layout (parallel, linear or classic)', c.layout) 343 | .option('-o, --output [path]', 'output to a given folder', c.output) 344 | .option('-c, --css [file]', 'use a custom css file', c.css) 345 | .option('-t, --template [file]', 'use a custom .jst template', c.template) 346 | .option('-e, --extension [ext]', 'assume a file extension for all inputs', c.extension) 347 | .option('-m, --marked [file]', 'use custom marked options', c.marked) 348 | .parse(args) 349 | .name = "docco" 350 | if commander.args.length 351 | document commander 352 | else 353 | console.log commander.helpInformation() 354 | 355 | 356 | Public API 357 | ---------- 358 | 359 | Docco = module.exports = {run, document, parse, format, version} 360 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Docco 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 | 14 |
15 | 16 | 17 |

Docco

18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 |

Docco is a quick-and-dirty documentation generator, written in 28 | Literate CoffeeScript. 29 | It produces an HTML document that displays your comments intermingled with your 30 | code. All prose is passed through 31 | Markdown, and code is 32 | passed through Highlight.js syntax highlighting. 33 | This page is the result of running Docco against its own 34 | source file.

35 |
    36 |
  1. Install Docco with npm: sudo npm install -g docco

    37 |
  2. 38 |
  3. Run it against your code: docco src/*.coffee

    39 |
  4. 40 |
41 |

There is no “Step 3”. This will generate an HTML page for each of the named 42 | source files, with a menu linking to the other pages, saving the whole mess 43 | into a docs folder (configurable).

44 |

The Docco source is available on GitHub, 45 | and is released under the Lil License.

46 |

Docco can be used to process code written in any programming language. If it 47 | doesn’t handle your favorite yet, feel free to 48 | add it to the list. 49 | Finally, the “literate” style of any 50 | language listed in languages.json 51 | is also supported — just tack an .md extension on the end: 52 | .coffee.md, .py.md, and so on.

53 |

Partners in Crime:

54 | 55 | 56 | 57 | 58 | 98 |

Note that not all ports support all Docco features.

99 |

Main Documentation Generation Functions

100 | 101 | 102 | 103 | 104 |

Generate the documentation for our configured source file by copying over static 105 | assets, reading all the source files in, splitting them up into prose+code 106 | sections, highlighting each file in the appropriate language, and printing them 107 | out in an HTML template.

108 | 109 | 110 |
document = (options = {}, callback) ->
111 |   config = configure options
112 | 
113 |   fs.mkdirs config.output, ->
114 | 
115 |     callback or= (error) -> throw error if error
116 |     copyAsset  = (file, callback) ->
117 |       return callback() unless fs.existsSync file
118 |       fs.copy file, path.join(config.output, path.basename(file)), callback
119 |     complete   = ->
120 |       copyAsset config.css, (error) ->
121 |         return callback error if error
122 |         return copyAsset config.public, callback if fs.existsSync config.public
123 |         callback()
124 | 
125 |     files = config.sources.slice()
126 | 
127 |     nextFile = ->
128 |       source = files.shift()
129 |       fs.readFile source, (error, buffer) ->
130 |         return callback error if error
131 | 
132 |         code = buffer.toString()
133 |         sections = parse source, code, config
134 |         format source, sections, config
135 |         write source, sections, config
136 |         if files.length then nextFile() else complete()
137 | 
138 |     nextFile()
139 | 140 | 141 | 142 |

Given a string of source code, parse out each block of prose and the code that 143 | follows it — by detecting which is which, line by line — and then create an 144 | individual section for it. Each section is an object with docsText and 145 | codeText properties, and eventually docsHtml and codeHtml as well.

146 | 147 | 148 |
parse = (source, code, config = {}) ->
149 |   lines    = code.split '\n'
150 |   sections = []
151 |   lang     = getLanguage source, config
152 |   hasCode  = docsText = codeText = ''
153 | 
154 |   save = ->
155 |     sections.push {docsText, codeText}
156 |     hasCode = docsText = codeText = ''
157 | 158 | 159 | 160 |

Our quick-and-dirty implementation of the literate programming style. Simply 161 | invert the prose and code relationship on a per-line basis, and then continue as 162 | normal below.

163 | 164 | 165 |
  if lang.literate
166 |     isText = maybeCode = yes
167 |     for line, i in lines
168 |       lines[i] = if maybeCode and match = /^([ ]{4}|[ ]{0,3}\t)/.exec line
169 |         isText = no
170 |         line[match[0].length..]
171 |       else if maybeCode = /^\s*$/.test line
172 |         if isText then lang.symbol else ''
173 |       else
174 |         isText = yes
175 |         lang.symbol + ' ' + line
176 | 
177 |   for line in lines
178 |     if line.match(lang.commentMatcher) and not line.match(lang.commentFilter)
179 |       save() if hasCode
180 |       docsText += (line = line.replace(lang.commentMatcher, '')) + '\n'
181 |       save() if /^(---+|===+)$/.test line
182 |     else
183 |       hasCode = yes
184 |       codeText += line + '\n'
185 |   save()
186 | 
187 |   sections
188 | 189 | 190 | 191 |

To format and highlight the now-parsed sections of code, we use Highlight.js 192 | over stdio, and run the text of their corresponding comments through 193 | Markdown, using Marked.

194 | 195 | 196 |
format = (source, sections, config) ->
197 |   language = getLanguage source, config
198 | 199 | 200 | 201 |

Pass any user defined options to Marked if specified via command line option

202 | 203 | 204 |
  markedOptions =
205 |     smartypants: true
206 | 
207 |   if config.marked
208 |     markedOptions = config.marked
209 | 
210 |   marked.setOptions markedOptions
211 | 212 | 213 | 214 |

Tell Marked how to highlight code blocks within comments, treating that code 215 | as either the language specified in the code block or the language of the file 216 | if not specified.

217 | 218 | 219 |
  marked.setOptions {
220 |     highlight: (code, lang) ->
221 |       lang or= language.name
222 | 
223 |       if highlightjs.getLanguage(lang)
224 |         highlightjs.highlight(code, {language: lang}).value
225 |       else
226 |         console.warn "docco: couldn't highlight code block with unknown language '#{lang}' in #{source}"
227 |         code
228 |   }
229 | 
230 |   for section, i in sections
231 |     code = highlightjs.highlight(section.codeText, {language: language.name}).value
232 |     code = code.replace(/\s+$/, '')
233 |     section.codeHtml = "<div class='highlight'><pre>#{code}</pre></div>"
234 |     section.docsHtml = marked(section.docsText)
235 | 236 | 237 | 238 |

Once all of the code has finished highlighting, we can write the resulting 239 | documentation file by passing the completed HTML sections into the template, 240 | and rendering it to the specified output path.

241 | 242 | 243 |
write = (source, sections, config) ->
244 | 
245 |   destination = (file) ->
246 |     path.join(config.output, path.dirname(file), path.basename(file, path.extname(file)) + '.html')
247 | 
248 |   relative = (file) ->
249 |     to = path.dirname(path.resolve(file))
250 |     from = path.dirname(path.resolve(destination(source)))
251 |     path.join(path.relative(from, to), path.basename(file))
252 | 253 | 254 | 255 |

The title of the file is either the first heading in the prose, or the 256 | name of the source file.

257 | 258 | 259 |
  firstSection = _.find sections, (section) ->
260 |     section.docsText.length > 0
261 |   first = marked.lexer(firstSection.docsText)[0] if firstSection
262 |   hasTitle = first and first.type is 'heading' and first.depth is 1
263 |   title = if hasTitle then first.text else path.basename source
264 |   css = relative path.join(config.output, path.basename(config.css))
265 | 
266 |   html = config.template {sources: config.sources, css,
267 |     title, hasTitle, sections, path, destination, relative}
268 | 
269 |   console.log "docco: #{source} -> #{destination source}"
270 |   fs.outputFileSync destination(source), html
271 | 272 | 273 | 274 |

Configuration

275 | 276 | 277 | 278 | 279 |

Default configuration options. All of these may be extended by 280 | user-specified options.

281 | 282 | 283 |
defaults =
284 |   layout:     'parallel'
285 |   output:     'docs'
286 |   template:   null
287 |   css:        null
288 |   extension:  null
289 |   languages:  {}
290 |   marked:     null
291 | 292 | 293 | 294 |

Configure this particular run of Docco. We might use a passed-in external 295 | template, or one of the built-in layouts. We only attempt to process 296 | source files for languages for which we have definitions.

297 | 298 | 299 |
configure = (options) ->
300 |   config = _.extend {}, defaults, _.pick(options.opts(), _.keys(defaults)...)
301 | 
302 |   config.languages = buildMatchers config.languages
303 | 304 | 305 | 306 |

The user is able to override the layout file used with the --template parameter. 307 | In this case, it is also neccessary to explicitly specify a stylesheet file. 308 | These custom templates are compiled exactly like the predefined ones, but the public folder 309 | is only copied for the latter.

310 | 311 | 312 |
  if config.template
313 |     unless config.css
314 |       console.warn "docco: no stylesheet file specified"
315 |     config.layout = null
316 |   else
317 |     dir = config.layout = path.join __dirname, 'resources', config.layout
318 |     config.public       = path.join dir, 'public' if fs.existsSync path.join dir, 'public'
319 |     config.template     = path.join dir, 'docco.jst'
320 |     config.css          = options.css or path.join dir, 'resources/linear/docco.css'
321 |   config.template = _.template fs.readFileSync(config.template).toString()
322 | 
323 |   if options.marked
324 |     config.marked = JSON.parse fs.readFileSync(options.marked)
325 | 
326 |   config.sources = options.args.filter((source) ->
327 |     lang = getLanguage source, config
328 |     console.warn "docco: skipped unknown type (#{path.basename source})" unless lang
329 |     lang
330 |   ).sort()
331 | 
332 |   config
333 | 334 | 335 | 336 |

Helpers & Initial Setup

337 | 338 | 339 | 340 | 341 |

Require our external dependencies.

342 | 343 | 344 |
_           = require 'underscore'
345 | fs          = require 'fs-extra'
346 | path        = require 'path'
347 | marked      = require('marked').marked
348 | commander   = require 'commander'
349 | highlightjs = require 'highlight.js'
350 | 351 | 352 | 353 |

Languages are stored in JSON in the file resources/languages.json. 354 | Each item maps the file extension to the name of the language and the 355 | symbol that indicates a line comment. To add support for a new programming 356 | language to Docco, just add it to the file.

357 | 358 | 359 |
languages = JSON.parse fs.readFileSync(path.join(__dirname, 'resources', 'languages.json'))
360 | 361 | 362 | 363 |

Build out the appropriate matchers and delimiters for each language.

364 | 365 | 366 |
buildMatchers = (languages) ->
367 |   for ext, l of languages
368 | 369 | 370 | 371 |

Does the line begin with a comment?

372 | 373 | 374 |
    l.commentMatcher = ///^\s*#{l.symbol}\s?///
375 | 376 | 377 | 378 |

Ignore hashbangs and interpolations…

379 | 380 | 381 |
    l.commentFilter = /(^#![/]|^\s*#\{)/
382 |   languages
383 | languages = buildMatchers languages
384 | 385 | 386 | 387 |

A function to get the current language we’re documenting, based on the 388 | file extension. Detect and tag “literate” .ext.md variants.

389 | 390 | 391 |
getLanguage = (source, config) ->
392 |   ext  = config.extension or path.extname(source) or path.basename(source)
393 |   lang = config.languages?[ext] or languages[ext]
394 |   if lang and lang.name is 'markdown'
395 |     codeExt = path.extname(path.basename(source, ext))
396 |     codeLang = config.languages?[codeExt] or languages[codeExt]
397 |     if codeExt and codeLang
398 |       lang = _.extend {}, codeLang, {literate: yes}
399 |   lang
400 | 401 | 402 | 403 |

Keep it DRY. Extract the docco version from package.json

404 | 405 | 406 |
version = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'))).version
407 | 408 | 409 | 410 |

Command Line Interface

411 | 412 | 413 | 414 | 415 |

Finally, let’s define the interface to run Docco from the command line. 416 | Parse options using Commander.

417 | 418 | 419 |
run = (args = process.argv) ->
420 |   c = defaults
421 |   commander.version(version)
422 |     .usage('[options] files')
423 |     .option('-L, --languages [file]', 'use a custom languages.json', _.compose JSON.parse, fs.readFileSync)
424 |     .option('-l, --layout [name]',    'choose a layout (parallel, linear or classic)', c.layout)
425 |     .option('-o, --output [path]',    'output to a given folder', c.output)
426 |     .option('-c, --css [file]',       'use a custom css file', c.css)
427 |     .option('-t, --template [file]',  'use a custom .jst template', c.template)
428 |     .option('-e, --extension [ext]',  'assume a file extension for all inputs', c.extension)
429 |     .option('-m, --marked [file]',    'use custom marked options', c.marked)
430 |     .parse(args)
431 |     .name = "docco"
432 |   if commander.args.length
433 |     document commander
434 |   else
435 |     console.log commander.helpInformation()
436 | 437 | 438 | 439 |

Public API

440 | 441 | 442 | 443 | 444 | 445 | 446 |
Docco = module.exports = {run, document, parse, format, version}
447 | 448 | 449 |
h
450 |
451 |
452 | 453 | 454 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docco", 3 | "version": "0.9.1", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "docco", 9 | "version": "0.9.1", 10 | "license": "MIT", 11 | "dependencies": { 12 | "commander": "~ 8.3.0", 13 | "fs-extra": "~ 10.0.0", 14 | "highlight.js": "~ 11.3.1", 15 | "marked": "~ 4.0.3", 16 | "underscore": "~ 1.13.1" 17 | }, 18 | "bin": { 19 | "docco": "bin/docco" 20 | }, 21 | "engines": { 22 | "node": ">=0.2.0" 23 | } 24 | }, 25 | "node_modules/commander": { 26 | "version": "8.3.0", 27 | "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", 28 | "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", 29 | "engines": { 30 | "node": ">= 12" 31 | } 32 | }, 33 | "node_modules/fs-extra": { 34 | "version": "10.0.0", 35 | "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", 36 | "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", 37 | "dependencies": { 38 | "graceful-fs": "^4.2.0", 39 | "jsonfile": "^6.0.1", 40 | "universalify": "^2.0.0" 41 | }, 42 | "engines": { 43 | "node": ">=12" 44 | } 45 | }, 46 | "node_modules/graceful-fs": { 47 | "version": "4.2.8", 48 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", 49 | "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" 50 | }, 51 | "node_modules/highlight.js": { 52 | "version": "11.3.1", 53 | "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.3.1.tgz", 54 | "integrity": "sha512-PUhCRnPjLtiLHZAQ5A/Dt5F8cWZeMyj9KRsACsWT+OD6OP0x6dp5OmT5jdx0JgEyPxPZZIPQpRN2TciUT7occw==", 55 | "engines": { 56 | "node": ">=12.0.0" 57 | } 58 | }, 59 | "node_modules/jsonfile": { 60 | "version": "6.1.0", 61 | "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", 62 | "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", 63 | "dependencies": { 64 | "universalify": "^2.0.0" 65 | }, 66 | "optionalDependencies": { 67 | "graceful-fs": "^4.1.6" 68 | } 69 | }, 70 | "node_modules/marked": { 71 | "version": "4.0.19", 72 | "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.19.tgz", 73 | "integrity": "sha512-rgQF/OxOiLcvgUAj1Q1tAf4Bgxn5h5JZTp04Fx4XUkVhs7B+7YA9JEWJhJpoO8eJt8MkZMwqLCNeNqj1bCREZQ==", 74 | "license": "MIT", 75 | "bin": { 76 | "marked": "bin/marked.js" 77 | }, 78 | "engines": { 79 | "node": ">= 12" 80 | } 81 | }, 82 | "node_modules/underscore": { 83 | "version": "1.13.1", 84 | "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.1.tgz", 85 | "integrity": "sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g==" 86 | }, 87 | "node_modules/universalify": { 88 | "version": "2.0.0", 89 | "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", 90 | "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", 91 | "engines": { 92 | "node": ">= 10.0.0" 93 | } 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docco", 3 | "description": "The Quick and Dirty Literate Programming Documentation Generator", 4 | "keywords": [ 5 | "documentation", 6 | "docs", 7 | "generator", 8 | "literate", 9 | "coffeescript" 10 | ], 11 | "author": "Jeremy Ashkenas", 12 | "version": "0.9.2", 13 | "license": "MIT", 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/jashkenas/docco.git" 17 | }, 18 | "engines": { 19 | "node": ">=0.2.0" 20 | }, 21 | "dependencies": { 22 | "commander": "~ 8.3.0", 23 | "marked": "~ 4.0.3", 24 | "fs-extra": "~ 10.0.0", 25 | "underscore": "~ 1.13.1", 26 | "highlight.js": "~ 11.3.1" 27 | }, 28 | "main": "./docco", 29 | "bin": { 30 | "docco": "bin/docco" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /resources/classic/docco.css: -------------------------------------------------------------------------------- 1 | /*--------------------- Layout and Typography ----------------------------*/ 2 | html { height: 100%; } 3 | body { 4 | font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; 5 | font-size: 14px; 6 | line-height: 16px; 7 | color: #252519; 8 | margin: 0; padding: 0; 9 | height:100%; 10 | } 11 | #container { min-height: 100%; } 12 | 13 | a { 14 | color: #261a3b; 15 | } 16 | 17 | a:visited { 18 | color: #261a3b; 19 | } 20 | 21 | p, ul, ol { 22 | margin: 0 0 15px; 23 | } 24 | 25 | h1, h2, h3, h4, h5, h6 { 26 | margin: 30px 0 15px 0; 27 | } 28 | 29 | h1 { 30 | margin-top: 40px; 31 | } 32 | 33 | hr { 34 | border: 0 none; 35 | border-top: 1px solid #e5e5ee; 36 | height: 1px; 37 | margin: 20px 0; 38 | } 39 | 40 | pre, tt, code { 41 | font-size: 12px; line-height: 16px; 42 | font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; 43 | margin: 0; padding: 0; 44 | } 45 | 46 | ul.sections { 47 | list-style: none; 48 | padding:0 0 5px 0;; 49 | margin:0; 50 | } 51 | 52 | /* 53 | Force border-box so that % widths fit the parent 54 | container without overlap because of margin/padding. 55 | 56 | More Info : http://www.quirksmode.org/css/box.html 57 | */ 58 | ul.sections > li > div { 59 | -moz-box-sizing: border-box; /* firefox */ 60 | -ms-box-sizing: border-box; /* ie */ 61 | -webkit-box-sizing: border-box; /* webkit */ 62 | -khtml-box-sizing: border-box; /* konqueror */ 63 | box-sizing: border-box; /* css3 */ 64 | } 65 | 66 | 67 | /*---------------------- Jump Page -----------------------------*/ 68 | #jump_to, #jump_page { 69 | margin: 0; 70 | background: white; 71 | -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; 72 | -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; 73 | font: 16px Arial; 74 | cursor: pointer; 75 | text-align: right; 76 | list-style: none; 77 | } 78 | 79 | #jump_to a { 80 | text-decoration: none; 81 | } 82 | 83 | #jump_to a.large { 84 | display: none; 85 | } 86 | #jump_to a.small { 87 | font-size: 22px; 88 | font-weight: bold; 89 | color: #676767; 90 | } 91 | 92 | #jump_to, #jump_wrapper { 93 | position: fixed; 94 | right: 0; top: 0; 95 | padding: 10px 15px; 96 | margin:0; 97 | } 98 | 99 | #jump_wrapper { 100 | display: none; 101 | padding:0; 102 | } 103 | 104 | #jump_to:hover #jump_wrapper { 105 | display: block; 106 | } 107 | 108 | #jump_page { 109 | padding: 5px 0 3px; 110 | margin: 0 0 25px 25px; 111 | } 112 | 113 | #jump_page .source { 114 | display: block; 115 | padding: 15px; 116 | text-decoration: none; 117 | border-top: 1px solid #eee; 118 | } 119 | 120 | #jump_page .source:hover { 121 | background: #f5f5ff; 122 | } 123 | 124 | #jump_page .source:first-child { 125 | } 126 | 127 | /*---------------------- Low resolutions (> 320px) ---------------------*/ 128 | @media only screen and (min-width: 320px) { 129 | .sswrap { display: none; } 130 | 131 | ul.sections > li > div { 132 | display: block; 133 | padding:5px 10px 0 10px; 134 | } 135 | 136 | ul.sections > li > div.annotation { 137 | background: #fff; 138 | } 139 | 140 | ul.sections > li > div.annotation ul, ul.sections > li > div.annotation ol { 141 | padding-left: 30px; 142 | } 143 | 144 | ul.sections > li > div.content { 145 | background: #f5f5ff; 146 | overflow-x:auto; 147 | -webkit-box-shadow: inset 0 0 5px #e5e5ee; 148 | box-shadow: inset 0 0 5px #e5e5ee; 149 | border: 1px solid #dedede; 150 | margin:5px 10px 5px 10px; 151 | padding-bottom: 5px; 152 | } 153 | 154 | ul.sections > li > div.annotation pre { 155 | margin: 7px 0 7px; 156 | padding-left: 15px; 157 | } 158 | 159 | ul.sections > li > div.annotation p tt, .annotation code { 160 | background: #f8f8ff; 161 | border: 1px solid #dedede; 162 | font-size: 12px; 163 | padding: 0 0.2em; 164 | } 165 | } 166 | 167 | /*---------------------- (> 481px) ---------------------*/ 168 | @media only screen and (min-width: 481px) { 169 | #container { 170 | position: relative; 171 | } 172 | body { 173 | background-color: #F5F5FF; 174 | font-size: 15px; 175 | line-height: 22px; 176 | } 177 | pre, tt, code { 178 | line-height: 18px; 179 | } 180 | 181 | #jump_to { 182 | padding: 5px 10px; 183 | } 184 | #jump_wrapper { 185 | padding: 0; 186 | } 187 | #jump_to, #jump_page { 188 | font: 10px Arial; 189 | text-transform: uppercase; 190 | } 191 | #jump_page .source { 192 | padding: 5px 10px; 193 | } 194 | #jump_to a.large { 195 | display: inline-block; 196 | } 197 | #jump_to a.small { 198 | display: none; 199 | } 200 | 201 | 202 | 203 | #background { 204 | position: absolute; 205 | top: 0; bottom: 0; 206 | width: 350px; 207 | background: #ffffff; 208 | border-right: 1px solid #e5e5ee; 209 | z-index: -1; 210 | } 211 | 212 | ul.sections > li > div.annotation ul, ul.sections > li > div.annotation ol { 213 | padding-left: 40px; 214 | } 215 | 216 | ul.sections > li { 217 | white-space: nowrap; 218 | } 219 | 220 | ul.sections > li > div { 221 | display: inline-block; 222 | } 223 | 224 | ul.sections > li > div.annotation { 225 | max-width: 350px; 226 | min-width: 350px; 227 | min-height: 5px; 228 | padding: 13px; 229 | overflow-x: hidden; 230 | white-space: normal; 231 | vertical-align: top; 232 | text-align: left; 233 | } 234 | ul.sections > li > div.annotation pre { 235 | margin: 15px 0 15px; 236 | padding-left: 15px; 237 | } 238 | 239 | ul.sections > li > div.content { 240 | padding: 13px; 241 | vertical-align: top; 242 | background: #f5f5ff; 243 | border: none; 244 | -webkit-box-shadow: none; 245 | box-shadow: none; 246 | } 247 | 248 | .sswrap { 249 | position: relative; 250 | display: inline; 251 | } 252 | 253 | .ss { 254 | font: 12px Arial; 255 | text-decoration: none; 256 | color: #454545; 257 | position: absolute; 258 | top: 3px; left: -20px; 259 | padding: 1px 2px; 260 | opacity: 0; 261 | -webkit-transition: opacity 0.2s linear; 262 | } 263 | .for-h1 .ss { 264 | top: 47px; 265 | } 266 | .for-h2 .ss, .for-h3 .ss, .for-h4 .ss { 267 | top: 35px; 268 | } 269 | 270 | ul.sections > li > div.annotation:hover .ss { 271 | opacity: 1; 272 | } 273 | } 274 | 275 | /*---------------------- (> 1025px) ---------------------*/ 276 | @media only screen and (min-width: 1025px) { 277 | 278 | #background { 279 | width: 525px; 280 | } 281 | ul.sections > li > div.annotation { 282 | max-width: 525px; 283 | min-width: 525px; 284 | padding: 10px 25px 1px 50px; 285 | } 286 | ul.sections > li > div.content { 287 | padding: 9px 15px 16px 25px; 288 | } 289 | } 290 | 291 | /*---------------------- Syntax Highlighting -----------------------------*/ 292 | 293 | td.linenos { background-color: #f0f0f0; padding-right: 10px; } 294 | span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } 295 | /* 296 | 297 | github.com style (c) Vasily Polovnyov 298 | 299 | */ 300 | 301 | pre code { 302 | display: block; padding: 0.5em; 303 | color: #000; 304 | background: #f8f8ff 305 | } 306 | 307 | pre .hljs-comment, 308 | pre .hljs-template_comment, 309 | pre .hljs-diff .hljs-header, 310 | pre .hljs-javadoc { 311 | color: #408080; 312 | font-style: italic 313 | } 314 | 315 | pre .hljs-keyword, 316 | pre .hljs-assignment, 317 | pre .hljs-literal, 318 | pre .hljs-css .hljs-rule .hljs-keyword, 319 | pre .hljs-winutils, 320 | pre .hljs-javascript .hljs-title, 321 | pre .hljs-lisp .hljs-title, 322 | pre .hljs-subst { 323 | color: #954121; 324 | /*font-weight: bold*/ 325 | } 326 | 327 | pre .hljs-number, 328 | pre .hljs-hexcolor { 329 | color: #40a070 330 | } 331 | 332 | pre .hljs-string, 333 | pre .hljs-tag .hljs-value, 334 | pre .hljs-phpdoc, 335 | pre .hljs-tex .hljs-formula { 336 | color: #219161; 337 | } 338 | 339 | pre .hljs-title, 340 | pre .hljs-id { 341 | color: #19469D; 342 | } 343 | pre .hljs-params { 344 | color: #00F; 345 | } 346 | 347 | pre .hljs-javascript .hljs-title, 348 | pre .hljs-lisp .hljs-title, 349 | pre .hljs-subst { 350 | font-weight: normal 351 | } 352 | 353 | pre .hljs-class .hljs-title, 354 | pre .hljs-haskell .hljs-label, 355 | pre .hljs-tex .hljs-command { 356 | color: #458; 357 | font-weight: bold 358 | } 359 | 360 | pre .hljs-tag, 361 | pre .hljs-tag .hljs-title, 362 | pre .hljs-rules .hljs-property, 363 | pre .hljs-django .hljs-tag .hljs-keyword { 364 | color: #000080; 365 | font-weight: normal 366 | } 367 | 368 | pre .hljs-attribute, 369 | pre .hljs-variable, 370 | pre .hljs-instancevar, 371 | pre .hljs-lisp .hljs-body { 372 | color: #008080 373 | } 374 | 375 | pre .hljs-regexp { 376 | color: #B68 377 | } 378 | 379 | pre .hljs-class { 380 | color: #458; 381 | font-weight: bold 382 | } 383 | 384 | pre .hljs-symbol, 385 | pre .hljs-ruby .hljs-symbol .hljs-string, 386 | pre .hljs-ruby .hljs-symbol .hljs-keyword, 387 | pre .hljs-ruby .hljs-symbol .hljs-keymethods, 388 | pre .hljs-lisp .hljs-keyword, 389 | pre .hljs-tex .hljs-special, 390 | pre .hljs-input_number { 391 | color: #990073 392 | } 393 | 394 | pre .hljs-builtin, 395 | pre .hljs-constructor, 396 | pre .hljs-built_in, 397 | pre .hljs-lisp .hljs-title { 398 | color: #0086b3 399 | } 400 | 401 | pre .hljs-preprocessor, 402 | pre .hljs-pi, 403 | pre .hljs-doctype, 404 | pre .hljs-shebang, 405 | pre .hljs-cdata { 406 | color: #999; 407 | font-weight: bold 408 | } 409 | 410 | pre .hljs-deletion { 411 | background: #fdd 412 | } 413 | 414 | pre .hljs-addition { 415 | background: #dfd 416 | } 417 | 418 | pre .hljs-diff .hljs-change { 419 | background: #0086b3 420 | } 421 | 422 | pre .hljs-chunk { 423 | color: #aaa 424 | } 425 | 426 | pre .hljs-tex .hljs-formula { 427 | opacity: 0.5; 428 | } 429 | -------------------------------------------------------------------------------- /resources/classic/docco.jst: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%= title %> 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 | <% if (sources.length > 1) { %> 14 | 29 | <% } %> 30 | 54 |
55 | 56 | 57 | -------------------------------------------------------------------------------- /resources/classic/public/fonts/aller-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/classic/public/fonts/aller-bold.eot -------------------------------------------------------------------------------- /resources/classic/public/fonts/aller-bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/classic/public/fonts/aller-bold.ttf -------------------------------------------------------------------------------- /resources/classic/public/fonts/aller-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/classic/public/fonts/aller-bold.woff -------------------------------------------------------------------------------- /resources/classic/public/fonts/aller-light.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/classic/public/fonts/aller-light.eot -------------------------------------------------------------------------------- /resources/classic/public/fonts/aller-light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/classic/public/fonts/aller-light.ttf -------------------------------------------------------------------------------- /resources/classic/public/fonts/aller-light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/classic/public/fonts/aller-light.woff -------------------------------------------------------------------------------- /resources/classic/public/fonts/fleurons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/classic/public/fonts/fleurons.eot -------------------------------------------------------------------------------- /resources/classic/public/fonts/fleurons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/classic/public/fonts/fleurons.ttf -------------------------------------------------------------------------------- /resources/classic/public/fonts/fleurons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/classic/public/fonts/fleurons.woff -------------------------------------------------------------------------------- /resources/classic/public/fonts/roboto-black.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/classic/public/fonts/roboto-black.eot -------------------------------------------------------------------------------- /resources/classic/public/fonts/roboto-black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/classic/public/fonts/roboto-black.ttf -------------------------------------------------------------------------------- /resources/classic/public/fonts/roboto-black.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/classic/public/fonts/roboto-black.woff -------------------------------------------------------------------------------- /resources/classic/public/images/gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/classic/public/images/gray.png -------------------------------------------------------------------------------- /resources/classic/public/stylesheets/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v2.0.1 | MIT License | git.io/normalize */ 2 | 3 | /* ========================================================================== 4 | HTML5 display definitions 5 | ========================================================================== */ 6 | 7 | /* 8 | * Corrects `block` display not defined in IE 8/9. 9 | */ 10 | 11 | article, 12 | aside, 13 | details, 14 | figcaption, 15 | figure, 16 | footer, 17 | header, 18 | hgroup, 19 | nav, 20 | section, 21 | summary { 22 | display: block; 23 | } 24 | 25 | /* 26 | * Corrects `inline-block` display not defined in IE 8/9. 27 | */ 28 | 29 | audio, 30 | canvas, 31 | video { 32 | display: inline-block; 33 | } 34 | 35 | /* 36 | * Prevents modern browsers from displaying `audio` without controls. 37 | * Remove excess height in iOS 5 devices. 38 | */ 39 | 40 | audio:not([controls]) { 41 | display: none; 42 | height: 0; 43 | } 44 | 45 | /* 46 | * Addresses styling for `hidden` attribute not present in IE 8/9. 47 | */ 48 | 49 | [hidden] { 50 | display: none; 51 | } 52 | 53 | /* ========================================================================== 54 | Base 55 | ========================================================================== */ 56 | 57 | /* 58 | * 1. Sets default font family to sans-serif. 59 | * 2. Prevents iOS text size adjust after orientation change, without disabling 60 | * user zoom. 61 | */ 62 | 63 | html { 64 | font-family: sans-serif; /* 1 */ 65 | -webkit-text-size-adjust: 100%; /* 2 */ 66 | -ms-text-size-adjust: 100%; /* 2 */ 67 | } 68 | 69 | /* 70 | * Removes default margin. 71 | */ 72 | 73 | body { 74 | margin: 0; 75 | } 76 | 77 | /* ========================================================================== 78 | Links 79 | ========================================================================== */ 80 | 81 | /* 82 | * Addresses `outline` inconsistency between Chrome and other browsers. 83 | */ 84 | 85 | a:focus { 86 | outline: thin dotted; 87 | } 88 | 89 | /* 90 | * Improves readability when focused and also mouse hovered in all browsers. 91 | */ 92 | 93 | a:active, 94 | a:hover { 95 | outline: 0; 96 | } 97 | 98 | /* ========================================================================== 99 | Typography 100 | ========================================================================== */ 101 | 102 | /* 103 | * Addresses `h1` font sizes within `section` and `article` in Firefox 4+, 104 | * Safari 5, and Chrome. 105 | */ 106 | 107 | h1 { 108 | font-size: 2em; 109 | } 110 | 111 | /* 112 | * Addresses styling not present in IE 8/9, Safari 5, and Chrome. 113 | */ 114 | 115 | abbr[title] { 116 | border-bottom: 1px dotted; 117 | } 118 | 119 | /* 120 | * Addresses style set to `bolder` in Firefox 4+, Safari 5, and Chrome. 121 | */ 122 | 123 | b, 124 | strong { 125 | font-weight: bold; 126 | } 127 | 128 | /* 129 | * Addresses styling not present in Safari 5 and Chrome. 130 | */ 131 | 132 | dfn { 133 | font-style: italic; 134 | } 135 | 136 | /* 137 | * Addresses styling not present in IE 8/9. 138 | */ 139 | 140 | mark { 141 | background: #ff0; 142 | color: #000; 143 | } 144 | 145 | 146 | /* 147 | * Corrects font family set oddly in Safari 5 and Chrome. 148 | */ 149 | 150 | code, 151 | kbd, 152 | pre, 153 | samp { 154 | font-family: monospace, serif; 155 | font-size: 1em; 156 | } 157 | 158 | /* 159 | * Improves readability of pre-formatted text in all browsers. 160 | */ 161 | 162 | pre { 163 | white-space: pre; 164 | white-space: pre-wrap; 165 | word-wrap: break-word; 166 | } 167 | 168 | /* 169 | * Sets consistent quote types. 170 | */ 171 | 172 | q { 173 | quotes: "\201C" "\201D" "\2018" "\2019"; 174 | } 175 | 176 | /* 177 | * Addresses inconsistent and variable font size in all browsers. 178 | */ 179 | 180 | small { 181 | font-size: 80%; 182 | } 183 | 184 | /* 185 | * Prevents `sub` and `sup` affecting `line-height` in all browsers. 186 | */ 187 | 188 | sub, 189 | sup { 190 | font-size: 75%; 191 | line-height: 0; 192 | position: relative; 193 | vertical-align: baseline; 194 | } 195 | 196 | sup { 197 | top: -0.5em; 198 | } 199 | 200 | sub { 201 | bottom: -0.25em; 202 | } 203 | 204 | /* ========================================================================== 205 | Embedded content 206 | ========================================================================== */ 207 | 208 | /* 209 | * Removes border when inside `a` element in IE 8/9. 210 | */ 211 | 212 | img { 213 | border: 0; 214 | } 215 | 216 | /* 217 | * Corrects overflow displayed oddly in IE 9. 218 | */ 219 | 220 | svg:not(:root) { 221 | overflow: hidden; 222 | } 223 | 224 | /* ========================================================================== 225 | Figures 226 | ========================================================================== */ 227 | 228 | /* 229 | * Addresses margin not present in IE 8/9 and Safari 5. 230 | */ 231 | 232 | figure { 233 | margin: 0; 234 | } 235 | 236 | /* ========================================================================== 237 | Forms 238 | ========================================================================== */ 239 | 240 | /* 241 | * Define consistent border, margin, and padding. 242 | */ 243 | 244 | fieldset { 245 | border: 1px solid #c0c0c0; 246 | margin: 0 2px; 247 | padding: 0.35em 0.625em 0.75em; 248 | } 249 | 250 | /* 251 | * 1. Corrects color not being inherited in IE 8/9. 252 | * 2. Remove padding so people aren't caught out if they zero out fieldsets. 253 | */ 254 | 255 | legend { 256 | border: 0; /* 1 */ 257 | padding: 0; /* 2 */ 258 | } 259 | 260 | /* 261 | * 1. Corrects font family not being inherited in all browsers. 262 | * 2. Corrects font size not being inherited in all browsers. 263 | * 3. Addresses margins set differently in Firefox 4+, Safari 5, and Chrome 264 | */ 265 | 266 | button, 267 | input, 268 | select, 269 | textarea { 270 | font-family: inherit; /* 1 */ 271 | font-size: 100%; /* 2 */ 272 | margin: 0; /* 3 */ 273 | } 274 | 275 | /* 276 | * Addresses Firefox 4+ setting `line-height` on `input` using `!important` in 277 | * the UA stylesheet. 278 | */ 279 | 280 | button, 281 | input { 282 | line-height: normal; 283 | } 284 | 285 | /* 286 | * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` 287 | * and `video` controls. 288 | * 2. Corrects inability to style clickable `input` types in iOS. 289 | * 3. Improves usability and consistency of cursor style between image-type 290 | * `input` and others. 291 | */ 292 | 293 | button, 294 | html input[type="button"], /* 1 */ 295 | input[type="reset"], 296 | input[type="submit"] { 297 | -webkit-appearance: button; /* 2 */ 298 | cursor: pointer; /* 3 */ 299 | } 300 | 301 | /* 302 | * Re-set default cursor for disabled elements. 303 | */ 304 | 305 | button[disabled], 306 | input[disabled] { 307 | cursor: default; 308 | } 309 | 310 | /* 311 | * 1. Addresses box sizing set to `content-box` in IE 8/9. 312 | * 2. Removes excess padding in IE 8/9. 313 | */ 314 | 315 | input[type="checkbox"], 316 | input[type="radio"] { 317 | box-sizing: border-box; /* 1 */ 318 | padding: 0; /* 2 */ 319 | } 320 | 321 | /* 322 | * 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome. 323 | * 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome 324 | * (include `-moz` to future-proof). 325 | */ 326 | 327 | input[type="search"] { 328 | -webkit-appearance: textfield; /* 1 */ 329 | -moz-box-sizing: content-box; 330 | -webkit-box-sizing: content-box; /* 2 */ 331 | box-sizing: content-box; 332 | } 333 | 334 | /* 335 | * Removes inner padding and search cancel button in Safari 5 and Chrome 336 | * on OS X. 337 | */ 338 | 339 | input[type="search"]::-webkit-search-cancel-button, 340 | input[type="search"]::-webkit-search-decoration { 341 | -webkit-appearance: none; 342 | } 343 | 344 | /* 345 | * Removes inner padding and border in Firefox 4+. 346 | */ 347 | 348 | button::-moz-focus-inner, 349 | input::-moz-focus-inner { 350 | border: 0; 351 | padding: 0; 352 | } 353 | 354 | /* 355 | * 1. Removes default vertical scrollbar in IE 8/9. 356 | * 2. Improves readability and alignment in all browsers. 357 | */ 358 | 359 | textarea { 360 | overflow: auto; /* 1 */ 361 | vertical-align: top; /* 2 */ 362 | } 363 | 364 | /* ========================================================================== 365 | Tables 366 | ========================================================================== */ 367 | 368 | /* 369 | * Remove most spacing between table cells. 370 | */ 371 | 372 | table { 373 | border-collapse: collapse; 374 | border-spacing: 0; 375 | } -------------------------------------------------------------------------------- /resources/languages.json: -------------------------------------------------------------------------------- 1 | { 2 | "Cakefile": {"name": "coffeescript", "symbol": "#"}, 3 | ".applescript": {"name": "applescript", "symbol": "--"}, 4 | ".as": {"name": "actionscript", "symbol": "//"}, 5 | ".asm": {"name": "assembly", "symbol": ";"}, 6 | ".asp": {"name": "vbscript", "symbol": "'"}, 7 | ".bat": {"name": "dos", "symbol": "@?rem"}, 8 | ".btm": {"name": "dos", "symbol": "@?rem"}, 9 | ".c": {"name": "c", "symbol": "//"}, 10 | ".clj": {"name": "clojure", "symbol": ";"}, 11 | ".cls": {"name": "tex", "symbol": "%"}, 12 | ".cmake": {"name": "cmake", "symbol": "#"}, 13 | ".cmd": {"name": "dos", "symbol": "@?rem"}, 14 | ".coffee": {"name": "coffeescript", "symbol": "#"}, 15 | ".cjsx": {"name": "coffeescript", "symbol": "#"}, 16 | ".cpp": {"name": "cpp", "symbol": "//"}, 17 | ".cs": {"name": "cs", "symbol": "//"}, 18 | ".cson": {"name": "coffeescript", "symbol": "#"}, 19 | ".d": {"name": "d", "symbol": "//"}, 20 | ".dart": {"name": "dart", "symbol": "///"}, 21 | ".dtx": {"name": "tex", "symbol": "%"}, 22 | ".erl": {"name": "erlang", "symbol": "%"}, 23 | ".f": {"name": "fortran", "symbol": "!"}, 24 | ".for": {"name": "fortran", "symbol": "!"}, 25 | ".frag": {"name": "glsl", "symbol": "//"}, 26 | ".glsl": {"name": "glsl", "symbol": "//"}, 27 | ".go": {"name": "go", "symbol": "//"}, 28 | ".groovy": {"name": "groovy", "symbol": "//"}, 29 | ".h": {"name": "objectivec", "symbol": "//"}, 30 | ".hpp": {"name": "cpp", "symbol": "//"}, 31 | ".hrl": {"name": "erlang", "symbol": "%"}, 32 | ".hs": {"name": "haskell", "symbol": "--"}, 33 | ".ini": {"name": "ini", "symbol": ";"}, 34 | ".jade": {"name": "jade", "symbol": "//-"}, 35 | ".js": {"name": "javascript", "symbol": "//"}, 36 | ".jsm": {"name": "javascript", "symbol": "//"}, 37 | ".json5": {"name": "javascript", "symbol": "//"}, 38 | ".jsx": {"name": "javascript", "symbol": "//"}, 39 | ".java": {"name": "java", "symbol": "//"}, 40 | ".latex": {"name": "tex", "symbol": "%"}, 41 | ".less": {"name": "less", "symbol": "//"}, 42 | ".lisp": {"name": "lisp", "symbol": ";"}, 43 | ".litcoffee": {"name": "coffeescript", "symbol": "#", "literate": true}, 44 | ".ls": {"name": "coffeescript", "symbol": "#"}, 45 | ".lua": {"name": "lua", "symbol": "--"}, 46 | ".n": {"name": "nemerle", "symbol": "//"}, 47 | ".m": {"name": "objectivec", "symbol": "//"}, 48 | ".mel": {"name": "mel", "symbol": "//"}, 49 | ".markdown": {"name": "markdown", "symbol": ""}, 50 | ".md": {"name": "markdown", "symbol": ""}, 51 | ".mm": {"name": "objectivec", "symbol": "//"}, 52 | ".p": {"name": "delphi", "symbol": "//"}, 53 | ".pas": {"name": "delphi", "symbol": "//"}, 54 | ".php": {"name": "php", "symbol": "//"}, 55 | ".pl": {"name": "perl", "symbol": "#"}, 56 | ".pm": {"name": "perl", "symbol": "#"}, 57 | ".pod": {"name": "perl", "symbol": "#"}, 58 | ".pp": {"name": "delphi", "symbol": "//"}, 59 | ".py": {"name": "python", "symbol": "#"}, 60 | ".rb": {"name": "ruby", "symbol": "#"}, 61 | ".tex": {"name": "tex", "symbol": "%"}, 62 | ".scala": {"name": "scala", "symbol": "//"}, 63 | ".scpt": {"name": "applescript", "symbol": "--"}, 64 | ".scss": {"name": "scss", "symbol": "//"}, 65 | ".sh": {"name": "bash", "symbol": "#"}, 66 | ".sql": {"name": "sql", "symbol": "--"}, 67 | ".sty": {"name": "tex", "symbol": "%"}, 68 | ".styl": {"name": "stylus", "symbol": "//"}, 69 | ".stylus": {"name": "stylus", "symbol": "//"}, 70 | ".swift": {"name": "swift", "symbol": "//"}, 71 | ".t": {"name": "perl", "symbol": "#"}, 72 | ".ts": {"name": "typescript", "symbol": "//"}, 73 | ".v": {"name": "verilog", "symbol": "//"}, 74 | ".vala": {"name": "vala", "symbol": "//"}, 75 | ".vapi": {"name": "vala", "symbol": "//"}, 76 | ".vbe": {"name": "vbscript", "symbol": "'"}, 77 | ".vbs": {"name": "vbscript", "symbol": "'"}, 78 | ".vert": {"name": "glsl", "symbol": "//"}, 79 | ".vhdl": {"name": "vhdl", "symbol": "--"}, 80 | ".vim": {"name": "vim", "symbol": "\""}, 81 | ".vue": {"name": "vuejs", "symbol": "//"}, 82 | ".r": {"name": "r", "symbol": "#"}, 83 | ".rc": {"name": "rust", "symbol": "//"}, 84 | ".rs": {"name": "rust", "symbol": "//"}, 85 | ".wsc": {"name": "vbscript", "symbol": "'"}, 86 | ".wsf": {"name": "vbscript", "symbol": "'"}, 87 | ".yaml": {"name": "yaml", "symbol": "#"} 88 | } 89 | -------------------------------------------------------------------------------- /resources/linear/docco.css: -------------------------------------------------------------------------------- 1 | /*--------------------- Typography ----------------------------*/ 2 | 3 | @font-face { 4 | font-family: 'aller-light'; 5 | src: url('public/fonts/aller-light.eot'); 6 | src: url('public/fonts/aller-light.eot?#iefix') format('embedded-opentype'), 7 | url('public/fonts/aller-light.woff') format('woff'), 8 | url('public/fonts/aller-light.ttf') format('truetype'); 9 | font-weight: normal; 10 | font-style: normal; 11 | } 12 | 13 | @font-face { 14 | font-family: 'aller-bold'; 15 | src: url('public/fonts/aller-bold.eot'); 16 | src: url('public/fonts/aller-bold.eot?#iefix') format('embedded-opentype'), 17 | url('public/fonts/aller-bold.woff') format('woff'), 18 | url('public/fonts/aller-bold.ttf') format('truetype'); 19 | font-weight: normal; 20 | font-style: normal; 21 | } 22 | 23 | @font-face { 24 | font-family: 'roboto-black'; 25 | src: url('public/fonts/roboto-black.eot'); 26 | src: url('public/fonts/roboto-black.eot?#iefix') format('embedded-opentype'), 27 | url('public/fonts/roboto-black.woff') format('woff'), 28 | url('public/fonts/roboto-black.ttf') format('truetype'); 29 | font-weight: normal; 30 | font-style: normal; 31 | } 32 | 33 | @font-face { 34 | font-family: 'fleurons'; 35 | src: url('public/fonts/fleurons.eot'); 36 | src: url('public/fonts/fleurons.eot?#iefix') format('embedded-opentype'), 37 | url('public/fonts/fleurons.woff') format('woff'), 38 | url('public/fonts/fleurons.ttf') format('truetype'); 39 | font-weight: normal; 40 | font-style: normal; 41 | } 42 | 43 | /*--------------------- Base Styles ----------------------------*/ 44 | 45 | body { 46 | font-family: "aller-light"; 47 | background: url('public/images/gray.png') #fff; 48 | background-size: 322px; 49 | margin: 0; 50 | } 51 | 52 | hr { 53 | height: 1px; 54 | background: #ddd; 55 | border: 0; 56 | } 57 | 58 | h1, h2, h3, h4, h5, h6 { 59 | color: #112233; 60 | font-weight: normal; 61 | font-family: "roboto-black"; 62 | text-transform: uppercase; 63 | line-height: 1em; 64 | margin-top: 50px; 65 | } 66 | h1 { 67 | margin: 0; 68 | text-align: center; 69 | } 70 | h2 { 71 | font-size: 1.26em; 72 | } 73 | h1:after { 74 | content: "8"; 75 | display: block; 76 | font-family: "fleurons"; 77 | color: #999; 78 | font-size: 80px; 79 | padding: 10px 0 25px; 80 | } 81 | 82 | a { 83 | color: #000; 84 | } 85 | 86 | b, strong { 87 | font-weight: normal; 88 | font-family: "aller-bold"; 89 | } 90 | 91 | blockquote { 92 | border-left: 5px solid #ccc; 93 | margin-left: 0; 94 | padding: 1px 0 1px 1em; 95 | } 96 | .page blockquote p { 97 | font-family: Menlo, Consolas, Monaco, monospace; 98 | font-size: 14px; line-height: 19px; 99 | color: #999; 100 | margin: 10px 0 0; 101 | white-space: pre-wrap; 102 | } 103 | 104 | pre, tt, code { 105 | font-family: Menlo, Consolas, Monaco, monospace; 106 | font-size: 12px; 107 | display: inline-block; 108 | border: 1px solid #EAEAEA; 109 | background: #f8f8f8; 110 | color: #555; 111 | padding: 0 5px; 112 | line-height: 20px; 113 | } 114 | .page pre { 115 | margin: 0; 116 | width: 608px; 117 | padding: 10px 15px; 118 | background: #fcfcfc; 119 | -moz-box-shadow: inset 0 0 10px rgba(0,0,0,0.1); 120 | -webkit-box-shadow: inset 0 0 10px rgba(0,0,0,0.1); 121 | box-shadow: inset 0 0 10px rgba(0,0,0,0.1); 122 | overflow-x: auto; 123 | } 124 | .page pre code { 125 | border: 0; 126 | padding: 0; 127 | background: transparent; 128 | } 129 | 130 | .fleur { 131 | font-family: "fleurons"; 132 | font-size: 100px; 133 | text-align: center; 134 | margin: 40px 0; 135 | color: #ccc; 136 | } 137 | 138 | /*--------------------- Layout ----------------------------*/ 139 | 140 | .container { 141 | width: 760px; 142 | margin: 0 auto; 143 | background: #fff; 144 | background: rgba(255,255,255, 0.4); 145 | overflow: hidden; 146 | } 147 | .page { 148 | width: 640px; 149 | padding: 30px; 150 | margin: 30px; 151 | background: #fff; 152 | font-size: 17px; 153 | line-height: 26px; 154 | } 155 | .page p { 156 | color: #30404f; 157 | margin: 26px 0; 158 | } 159 | 160 | ul.sections { 161 | list-style: none; 162 | padding:0 0 5px 0;; 163 | margin:0; 164 | } 165 | 166 | .page li p { 167 | margin: 12px 0; 168 | } 169 | 170 | .toc { 171 | max-height: 0; 172 | overflow: hidden; 173 | text-align: center; 174 | font-size: 13px; 175 | line-height: 20px; 176 | -moz-transition: max-height 1s; 177 | -webkit-transition: max-height 1s; 178 | transition: max-height 1s; 179 | } 180 | .header:hover .toc { 181 | max-height: 500px; 182 | } 183 | .toc h3 { 184 | margin-top: 20px; 185 | } 186 | .toc ol { 187 | margin: 0 0 20px 0; 188 | display: inline-block; 189 | text-align: left; 190 | list-style-type: upper-roman; 191 | } 192 | .toc li { 193 | font-family: 'roboto-black'; 194 | } 195 | .toc li a { 196 | font-family: 'aller-light'; 197 | } 198 | 199 | 200 | /*---------------------- Syntax Highlighting -----------------------------*/ 201 | 202 | td.linenos { background-color: #f0f0f0; padding-right: 10px; } 203 | span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } 204 | /* 205 | 206 | github.com style (c) Vasily Polovnyov 207 | 208 | */ 209 | 210 | pre code { 211 | display: block; padding: 0.5em; 212 | color: #000; 213 | background: #f8f8ff 214 | } 215 | 216 | pre .hljs-comment, 217 | pre .hljs-template_comment, 218 | pre .hljs-diff .hljs-header, 219 | pre .hljs-javadoc { 220 | color: #408080; 221 | font-style: italic 222 | } 223 | 224 | pre .hljs-keyword, 225 | pre .hljs-assignment, 226 | pre .hljs-literal, 227 | pre .hljs-css .hljs-rule .hljs-keyword, 228 | pre .hljs-winutils, 229 | pre .hljs-javascript .hljs-title, 230 | pre .hljs-lisp .hljs-title, 231 | pre .hljs-subst { 232 | color: #954121; 233 | /*font-weight: bold*/ 234 | } 235 | 236 | pre .hljs-number, 237 | pre .hljs-hexcolor { 238 | color: #40a070 239 | } 240 | 241 | pre .hljs-string, 242 | pre .hljs-tag .hljs-value, 243 | pre .hljs-phpdoc, 244 | pre .hljs-tex .hljs-formula { 245 | color: #219161; 246 | } 247 | 248 | pre .hljs-title, 249 | pre .hljs-id { 250 | color: #19469D; 251 | } 252 | pre .hljs-params { 253 | color: #00F; 254 | } 255 | 256 | pre .hljs-javascript .hljs-title, 257 | pre .hljs-lisp .hljs-title, 258 | pre .hljs-subst { 259 | font-weight: normal 260 | } 261 | 262 | pre .hljs-class .hljs-title, 263 | pre .hljs-haskell .hljs-label, 264 | pre .hljs-tex .hljs-command { 265 | color: #458; 266 | font-weight: bold 267 | } 268 | 269 | pre .hljs-tag, 270 | pre .hljs-tag .hljs-title, 271 | pre .hljs-rules .hljs-property, 272 | pre .hljs-django .hljs-tag .hljs-keyword { 273 | color: #000080; 274 | font-weight: normal 275 | } 276 | 277 | pre .hljs-attribute, 278 | pre .hljs-variable, 279 | pre .hljs-instancevar, 280 | pre .hljs-lisp .hljs-body { 281 | color: #008080 282 | } 283 | 284 | pre .hljs-regexp { 285 | color: #B68 286 | } 287 | 288 | pre .hljs-class { 289 | color: #458; 290 | font-weight: bold 291 | } 292 | 293 | pre .hljs-symbol, 294 | pre .hljs-ruby .hljs-symbol .hljs-string, 295 | pre .hljs-ruby .hljs-symbol .hljs-keyword, 296 | pre .hljs-ruby .hljs-symbol .hljs-keymethods, 297 | pre .hljs-lisp .hljs-keyword, 298 | pre .hljs-tex .hljs-special, 299 | pre .hljs-input_number { 300 | color: #990073 301 | } 302 | 303 | pre .hljs-builtin, 304 | pre .hljs-constructor, 305 | pre .hljs-built_in, 306 | pre .hljs-lisp .hljs-title { 307 | color: #0086b3 308 | } 309 | 310 | pre .hljs-preprocessor, 311 | pre .hljs-pi, 312 | pre .hljs-doctype, 313 | pre .hljs-shebang, 314 | pre .hljs-cdata { 315 | color: #999; 316 | font-weight: bold 317 | } 318 | 319 | pre .hljs-deletion { 320 | background: #fdd 321 | } 322 | 323 | pre .hljs-addition { 324 | background: #dfd 325 | } 326 | 327 | pre .hljs-diff .hljs-change { 328 | background: #0086b3 329 | } 330 | 331 | pre .hljs-chunk { 332 | color: #aaa 333 | } 334 | 335 | pre .hljs-tex .hljs-formula { 336 | opacity: 0.5; 337 | } 338 | -------------------------------------------------------------------------------- /resources/linear/docco.jst: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%= title %> 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 | 14 |
15 | <% if (hasTitle) { %> 16 | <% var section = sections.shift(); %> 17 | <%= section.docsHtml %> 18 | <% if (!(/^\s*$/).test(section.codeText)) { %> 19 | <%= section.codeHtml %> 20 | <% } %> 21 | <% } else { %> 22 |

<%= title %>

23 | <% } %> 24 | 25 | <% if (sources.length > 1) { %> 26 |
27 |

Table of Contents

28 |
    29 | <% for (var i=0, l = sources.length; i < l; i++) { %> 30 | <% var source = sources[i]; %> 31 |
  1. 32 | 33 | <%= source %> 34 | 35 |
  2. 36 | <% } %> 37 |
38 |
39 | <% } %> 40 |
41 | 42 | <% for (var i = 0, l = sections.length; i 43 | <% var section = sections[i]; %> 44 | <%= section.docsHtml %> 45 | <% if (!(/^\s*$/).test(section.codeText)) { %> 46 | <%= section.codeHtml %> 47 | <% } %> 48 | <% } %> 49 |
h
50 |
51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /resources/linear/public/fonts/aller-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/linear/public/fonts/aller-bold.eot -------------------------------------------------------------------------------- /resources/linear/public/fonts/aller-bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/linear/public/fonts/aller-bold.ttf -------------------------------------------------------------------------------- /resources/linear/public/fonts/aller-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/linear/public/fonts/aller-bold.woff -------------------------------------------------------------------------------- /resources/linear/public/fonts/aller-light.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/linear/public/fonts/aller-light.eot -------------------------------------------------------------------------------- /resources/linear/public/fonts/aller-light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/linear/public/fonts/aller-light.ttf -------------------------------------------------------------------------------- /resources/linear/public/fonts/aller-light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/linear/public/fonts/aller-light.woff -------------------------------------------------------------------------------- /resources/linear/public/fonts/fleurons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/linear/public/fonts/fleurons.eot -------------------------------------------------------------------------------- /resources/linear/public/fonts/fleurons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/linear/public/fonts/fleurons.ttf -------------------------------------------------------------------------------- /resources/linear/public/fonts/fleurons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/linear/public/fonts/fleurons.woff -------------------------------------------------------------------------------- /resources/linear/public/fonts/roboto-black.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/linear/public/fonts/roboto-black.eot -------------------------------------------------------------------------------- /resources/linear/public/fonts/roboto-black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/linear/public/fonts/roboto-black.ttf -------------------------------------------------------------------------------- /resources/linear/public/fonts/roboto-black.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/linear/public/fonts/roboto-black.woff -------------------------------------------------------------------------------- /resources/linear/public/images/gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/linear/public/images/gray.png -------------------------------------------------------------------------------- /resources/linear/public/stylesheets/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v2.0.1 | MIT License | git.io/normalize */ 2 | 3 | /* ========================================================================== 4 | HTML5 display definitions 5 | ========================================================================== */ 6 | 7 | /* 8 | * Corrects `block` display not defined in IE 8/9. 9 | */ 10 | 11 | article, 12 | aside, 13 | details, 14 | figcaption, 15 | figure, 16 | footer, 17 | header, 18 | hgroup, 19 | nav, 20 | section, 21 | summary { 22 | display: block; 23 | } 24 | 25 | /* 26 | * Corrects `inline-block` display not defined in IE 8/9. 27 | */ 28 | 29 | audio, 30 | canvas, 31 | video { 32 | display: inline-block; 33 | } 34 | 35 | /* 36 | * Prevents modern browsers from displaying `audio` without controls. 37 | * Remove excess height in iOS 5 devices. 38 | */ 39 | 40 | audio:not([controls]) { 41 | display: none; 42 | height: 0; 43 | } 44 | 45 | /* 46 | * Addresses styling for `hidden` attribute not present in IE 8/9. 47 | */ 48 | 49 | [hidden] { 50 | display: none; 51 | } 52 | 53 | /* ========================================================================== 54 | Base 55 | ========================================================================== */ 56 | 57 | /* 58 | * 1. Sets default font family to sans-serif. 59 | * 2. Prevents iOS text size adjust after orientation change, without disabling 60 | * user zoom. 61 | */ 62 | 63 | html { 64 | font-family: sans-serif; /* 1 */ 65 | -webkit-text-size-adjust: 100%; /* 2 */ 66 | -ms-text-size-adjust: 100%; /* 2 */ 67 | } 68 | 69 | /* 70 | * Removes default margin. 71 | */ 72 | 73 | body { 74 | margin: 0; 75 | } 76 | 77 | /* ========================================================================== 78 | Links 79 | ========================================================================== */ 80 | 81 | /* 82 | * Addresses `outline` inconsistency between Chrome and other browsers. 83 | */ 84 | 85 | a:focus { 86 | outline: thin dotted; 87 | } 88 | 89 | /* 90 | * Improves readability when focused and also mouse hovered in all browsers. 91 | */ 92 | 93 | a:active, 94 | a:hover { 95 | outline: 0; 96 | } 97 | 98 | /* ========================================================================== 99 | Typography 100 | ========================================================================== */ 101 | 102 | /* 103 | * Addresses `h1` font sizes within `section` and `article` in Firefox 4+, 104 | * Safari 5, and Chrome. 105 | */ 106 | 107 | h1 { 108 | font-size: 2em; 109 | } 110 | 111 | /* 112 | * Addresses styling not present in IE 8/9, Safari 5, and Chrome. 113 | */ 114 | 115 | abbr[title] { 116 | border-bottom: 1px dotted; 117 | } 118 | 119 | /* 120 | * Addresses style set to `bolder` in Firefox 4+, Safari 5, and Chrome. 121 | */ 122 | 123 | b, 124 | strong { 125 | font-weight: bold; 126 | } 127 | 128 | /* 129 | * Addresses styling not present in Safari 5 and Chrome. 130 | */ 131 | 132 | dfn { 133 | font-style: italic; 134 | } 135 | 136 | /* 137 | * Addresses styling not present in IE 8/9. 138 | */ 139 | 140 | mark { 141 | background: #ff0; 142 | color: #000; 143 | } 144 | 145 | 146 | /* 147 | * Corrects font family set oddly in Safari 5 and Chrome. 148 | */ 149 | 150 | code, 151 | kbd, 152 | pre, 153 | samp { 154 | font-family: monospace, serif; 155 | font-size: 1em; 156 | } 157 | 158 | /* 159 | * Improves readability of pre-formatted text in all browsers. 160 | */ 161 | 162 | pre { 163 | white-space: pre; 164 | white-space: pre-wrap; 165 | word-wrap: break-word; 166 | } 167 | 168 | /* 169 | * Sets consistent quote types. 170 | */ 171 | 172 | q { 173 | quotes: "\201C" "\201D" "\2018" "\2019"; 174 | } 175 | 176 | /* 177 | * Addresses inconsistent and variable font size in all browsers. 178 | */ 179 | 180 | small { 181 | font-size: 80%; 182 | } 183 | 184 | /* 185 | * Prevents `sub` and `sup` affecting `line-height` in all browsers. 186 | */ 187 | 188 | sub, 189 | sup { 190 | font-size: 75%; 191 | line-height: 0; 192 | position: relative; 193 | vertical-align: baseline; 194 | } 195 | 196 | sup { 197 | top: -0.5em; 198 | } 199 | 200 | sub { 201 | bottom: -0.25em; 202 | } 203 | 204 | /* ========================================================================== 205 | Embedded content 206 | ========================================================================== */ 207 | 208 | /* 209 | * Removes border when inside `a` element in IE 8/9. 210 | */ 211 | 212 | img { 213 | border: 0; 214 | } 215 | 216 | /* 217 | * Corrects overflow displayed oddly in IE 9. 218 | */ 219 | 220 | svg:not(:root) { 221 | overflow: hidden; 222 | } 223 | 224 | /* ========================================================================== 225 | Figures 226 | ========================================================================== */ 227 | 228 | /* 229 | * Addresses margin not present in IE 8/9 and Safari 5. 230 | */ 231 | 232 | figure { 233 | margin: 0; 234 | } 235 | 236 | /* ========================================================================== 237 | Forms 238 | ========================================================================== */ 239 | 240 | /* 241 | * Define consistent border, margin, and padding. 242 | */ 243 | 244 | fieldset { 245 | border: 1px solid #c0c0c0; 246 | margin: 0 2px; 247 | padding: 0.35em 0.625em 0.75em; 248 | } 249 | 250 | /* 251 | * 1. Corrects color not being inherited in IE 8/9. 252 | * 2. Remove padding so people aren't caught out if they zero out fieldsets. 253 | */ 254 | 255 | legend { 256 | border: 0; /* 1 */ 257 | padding: 0; /* 2 */ 258 | } 259 | 260 | /* 261 | * 1. Corrects font family not being inherited in all browsers. 262 | * 2. Corrects font size not being inherited in all browsers. 263 | * 3. Addresses margins set differently in Firefox 4+, Safari 5, and Chrome 264 | */ 265 | 266 | button, 267 | input, 268 | select, 269 | textarea { 270 | font-family: inherit; /* 1 */ 271 | font-size: 100%; /* 2 */ 272 | margin: 0; /* 3 */ 273 | } 274 | 275 | /* 276 | * Addresses Firefox 4+ setting `line-height` on `input` using `!important` in 277 | * the UA stylesheet. 278 | */ 279 | 280 | button, 281 | input { 282 | line-height: normal; 283 | } 284 | 285 | /* 286 | * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` 287 | * and `video` controls. 288 | * 2. Corrects inability to style clickable `input` types in iOS. 289 | * 3. Improves usability and consistency of cursor style between image-type 290 | * `input` and others. 291 | */ 292 | 293 | button, 294 | html input[type="button"], /* 1 */ 295 | input[type="reset"], 296 | input[type="submit"] { 297 | -webkit-appearance: button; /* 2 */ 298 | cursor: pointer; /* 3 */ 299 | } 300 | 301 | /* 302 | * Re-set default cursor for disabled elements. 303 | */ 304 | 305 | button[disabled], 306 | input[disabled] { 307 | cursor: default; 308 | } 309 | 310 | /* 311 | * 1. Addresses box sizing set to `content-box` in IE 8/9. 312 | * 2. Removes excess padding in IE 8/9. 313 | */ 314 | 315 | input[type="checkbox"], 316 | input[type="radio"] { 317 | box-sizing: border-box; /* 1 */ 318 | padding: 0; /* 2 */ 319 | } 320 | 321 | /* 322 | * 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome. 323 | * 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome 324 | * (include `-moz` to future-proof). 325 | */ 326 | 327 | input[type="search"] { 328 | -webkit-appearance: textfield; /* 1 */ 329 | -moz-box-sizing: content-box; 330 | -webkit-box-sizing: content-box; /* 2 */ 331 | box-sizing: content-box; 332 | } 333 | 334 | /* 335 | * Removes inner padding and search cancel button in Safari 5 and Chrome 336 | * on OS X. 337 | */ 338 | 339 | input[type="search"]::-webkit-search-cancel-button, 340 | input[type="search"]::-webkit-search-decoration { 341 | -webkit-appearance: none; 342 | } 343 | 344 | /* 345 | * Removes inner padding and border in Firefox 4+. 346 | */ 347 | 348 | button::-moz-focus-inner, 349 | input::-moz-focus-inner { 350 | border: 0; 351 | padding: 0; 352 | } 353 | 354 | /* 355 | * 1. Removes default vertical scrollbar in IE 8/9. 356 | * 2. Improves readability and alignment in all browsers. 357 | */ 358 | 359 | textarea { 360 | overflow: auto; /* 1 */ 361 | vertical-align: top; /* 2 */ 362 | } 363 | 364 | /* ========================================================================== 365 | Tables 366 | ========================================================================== */ 367 | 368 | /* 369 | * Remove most spacing between table cells. 370 | */ 371 | 372 | table { 373 | border-collapse: collapse; 374 | border-spacing: 0; 375 | } -------------------------------------------------------------------------------- /resources/parallel/docco.css: -------------------------------------------------------------------------------- 1 | /*--------------------- Typography ----------------------------*/ 2 | 3 | @font-face { 4 | font-family: 'aller-light'; 5 | src: url('public/fonts/aller-light.eot'); 6 | src: url('public/fonts/aller-light.eot?#iefix') format('embedded-opentype'), 7 | url('public/fonts/aller-light.woff') format('woff'), 8 | url('public/fonts/aller-light.ttf') format('truetype'); 9 | font-weight: normal; 10 | font-style: normal; 11 | } 12 | 13 | @font-face { 14 | font-family: 'aller-bold'; 15 | src: url('public/fonts/aller-bold.eot'); 16 | src: url('public/fonts/aller-bold.eot?#iefix') format('embedded-opentype'), 17 | url('public/fonts/aller-bold.woff') format('woff'), 18 | url('public/fonts/aller-bold.ttf') format('truetype'); 19 | font-weight: normal; 20 | font-style: normal; 21 | } 22 | 23 | @font-face { 24 | font-family: 'roboto-black'; 25 | src: url('public/fonts/roboto-black.eot'); 26 | src: url('public/fonts/roboto-black.eot?#iefix') format('embedded-opentype'), 27 | url('public/fonts/roboto-black.woff') format('woff'), 28 | url('public/fonts/roboto-black.ttf') format('truetype'); 29 | font-weight: normal; 30 | font-style: normal; 31 | } 32 | 33 | /*--------------------- Layout ----------------------------*/ 34 | html { height: 100%; } 35 | body { 36 | font-family: "aller-light"; 37 | font-size: 14px; 38 | line-height: 18px; 39 | color: #30404f; 40 | margin: 0; padding: 0; 41 | height:100%; 42 | } 43 | #container { min-height: 100%; } 44 | 45 | a { 46 | color: #000; 47 | } 48 | 49 | b, strong { 50 | font-weight: normal; 51 | font-family: "aller-bold"; 52 | } 53 | 54 | p { 55 | margin: 15px 0 0px; 56 | } 57 | .annotation ul, .annotation ol { 58 | margin: 25px 0; 59 | } 60 | .annotation ul li, .annotation ol li { 61 | font-size: 14px; 62 | line-height: 18px; 63 | margin: 10px 0; 64 | } 65 | 66 | h1, h2, h3, h4, h5, h6 { 67 | color: #112233; 68 | line-height: 1em; 69 | font-weight: normal; 70 | font-family: "roboto-black"; 71 | text-transform: uppercase; 72 | margin: 30px 0 15px 0; 73 | } 74 | 75 | h1 { 76 | margin-top: 40px; 77 | } 78 | h2 { 79 | font-size: 1.26em; 80 | } 81 | 82 | hr { 83 | border: 0; 84 | background: 1px #ddd; 85 | height: 1px; 86 | margin: 20px 0; 87 | } 88 | 89 | pre, tt, code { 90 | font-size: 12px; line-height: 16px; 91 | font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; 92 | margin: 0; padding: 0; 93 | } 94 | .annotation pre { 95 | display: block; 96 | margin: 0; 97 | padding: 7px 10px; 98 | background: #fcfcfc; 99 | -moz-box-shadow: inset 0 0 10px rgba(0,0,0,0.1); 100 | -webkit-box-shadow: inset 0 0 10px rgba(0,0,0,0.1); 101 | box-shadow: inset 0 0 10px rgba(0,0,0,0.1); 102 | overflow-x: auto; 103 | } 104 | .annotation pre code { 105 | border: 0; 106 | padding: 0; 107 | background: transparent; 108 | } 109 | 110 | 111 | blockquote { 112 | border-left: 5px solid #ccc; 113 | margin: 0; 114 | padding: 1px 0 1px 1em; 115 | } 116 | .sections blockquote p { 117 | font-family: Menlo, Consolas, Monaco, monospace; 118 | font-size: 12px; line-height: 16px; 119 | color: #999; 120 | margin: 10px 0 0; 121 | white-space: pre-wrap; 122 | } 123 | 124 | ul.sections { 125 | list-style: none; 126 | padding:0 0 5px 0;; 127 | margin:0; 128 | } 129 | 130 | /* 131 | Force border-box so that % widths fit the parent 132 | container without overlap because of margin/padding. 133 | 134 | More Info : http://www.quirksmode.org/css/box.html 135 | */ 136 | ul.sections > li > div { 137 | -moz-box-sizing: border-box; /* firefox */ 138 | -ms-box-sizing: border-box; /* ie */ 139 | -webkit-box-sizing: border-box; /* webkit */ 140 | -khtml-box-sizing: border-box; /* konqueror */ 141 | box-sizing: border-box; /* css3 */ 142 | } 143 | 144 | 145 | /*---------------------- Jump Page -----------------------------*/ 146 | #jump_to, #jump_page { 147 | margin: 0; 148 | background: white; 149 | -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; 150 | -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; 151 | font: 16px Arial; 152 | cursor: pointer; 153 | text-align: right; 154 | list-style: none; 155 | } 156 | 157 | #jump_to a { 158 | text-decoration: none; 159 | } 160 | 161 | #jump_to a.large { 162 | display: none; 163 | } 164 | #jump_to a.small { 165 | font-size: 22px; 166 | font-weight: bold; 167 | color: #676767; 168 | } 169 | 170 | #jump_to, #jump_wrapper { 171 | position: fixed; 172 | right: 0; top: 0; 173 | padding: 10px 15px; 174 | margin:0; 175 | } 176 | 177 | #jump_wrapper { 178 | display: none; 179 | padding:0; 180 | } 181 | 182 | #jump_to:hover #jump_wrapper { 183 | display: block; 184 | } 185 | 186 | #jump_page_wrapper{ 187 | position: fixed; 188 | right: 0; 189 | top: 0; 190 | bottom: 0; 191 | } 192 | 193 | #jump_page { 194 | padding: 5px 0 3px; 195 | margin: 0 0 25px 25px; 196 | max-height: 100%; 197 | overflow: auto; 198 | } 199 | 200 | #jump_page .source { 201 | display: block; 202 | padding: 15px; 203 | text-decoration: none; 204 | border-top: 1px solid #eee; 205 | } 206 | 207 | #jump_page .source:hover { 208 | background: #f5f5ff; 209 | } 210 | 211 | #jump_page .source:first-child { 212 | } 213 | 214 | /*---------------------- Low resolutions (> 320px) ---------------------*/ 215 | @media only screen and (min-width: 320px) { 216 | .sswrap { display: none; } 217 | 218 | ul.sections > li > div { 219 | display: block; 220 | padding:5px 10px 0 10px; 221 | } 222 | 223 | ul.sections > li > div.annotation ul, ul.sections > li > div.annotation ol { 224 | padding-left: 30px; 225 | } 226 | 227 | ul.sections > li > div.content { 228 | overflow-x:auto; 229 | -webkit-box-shadow: inset 0 0 5px #e5e5ee; 230 | box-shadow: inset 0 0 5px #e5e5ee; 231 | border: 1px solid #dedede; 232 | margin:5px 10px 5px 10px; 233 | padding-bottom: 5px; 234 | } 235 | 236 | ul.sections > li > div.annotation pre { 237 | margin: 7px 0 7px; 238 | padding-left: 15px; 239 | } 240 | 241 | ul.sections > li > div.annotation p tt, .annotation code { 242 | background: #f8f8ff; 243 | border: 1px solid #dedede; 244 | font-size: 12px; 245 | padding: 0 0.2em; 246 | } 247 | } 248 | 249 | /*---------------------- (> 481px) ---------------------*/ 250 | @media only screen and (min-width: 481px) { 251 | #container { 252 | position: relative; 253 | } 254 | body { 255 | background-color: #F5F5FF; 256 | font-size: 15px; 257 | line-height: 21px; 258 | } 259 | pre, tt, code { 260 | line-height: 18px; 261 | } 262 | p, ul, ol { 263 | margin: 0 0 15px; 264 | } 265 | 266 | 267 | #jump_to { 268 | padding: 5px 10px; 269 | } 270 | #jump_wrapper { 271 | padding: 0; 272 | } 273 | #jump_to, #jump_page { 274 | font: 10px Arial; 275 | text-transform: uppercase; 276 | } 277 | #jump_page .source { 278 | padding: 5px 10px; 279 | } 280 | #jump_to a.large { 281 | display: inline-block; 282 | } 283 | #jump_to a.small { 284 | display: none; 285 | } 286 | 287 | 288 | 289 | #background { 290 | position: absolute; 291 | top: 0; bottom: 0; 292 | width: 350px; 293 | background: #fff; 294 | border-right: 1px solid #e5e5ee; 295 | z-index: -1; 296 | } 297 | 298 | ul.sections > li > div.annotation ul, ul.sections > li > div.annotation ol { 299 | padding-left: 40px; 300 | } 301 | 302 | ul.sections > li { 303 | white-space: nowrap; 304 | } 305 | 306 | ul.sections > li > div { 307 | display: inline-block; 308 | } 309 | 310 | ul.sections > li > div.annotation { 311 | max-width: 350px; 312 | min-width: 350px; 313 | min-height: 5px; 314 | padding: 13px; 315 | overflow-x: hidden; 316 | white-space: normal; 317 | vertical-align: top; 318 | text-align: left; 319 | } 320 | ul.sections > li > div.annotation pre { 321 | margin: 15px 0 15px; 322 | padding-left: 15px; 323 | } 324 | 325 | ul.sections > li > div.content { 326 | padding: 13px; 327 | vertical-align: top; 328 | border: none; 329 | -webkit-box-shadow: none; 330 | box-shadow: none; 331 | } 332 | 333 | .sswrap { 334 | position: relative; 335 | display: inline; 336 | } 337 | 338 | .ss { 339 | font: 12px Arial; 340 | text-decoration: none; 341 | color: #454545; 342 | position: absolute; 343 | top: 3px; left: -20px; 344 | padding: 1px 2px; 345 | opacity: 0; 346 | -webkit-transition: opacity 0.2s linear; 347 | } 348 | .for-h1 .ss { 349 | top: 47px; 350 | } 351 | .for-h2 .ss, .for-h3 .ss, .for-h4 .ss { 352 | top: 35px; 353 | } 354 | 355 | ul.sections > li > div.annotation:hover .ss { 356 | opacity: 1; 357 | } 358 | } 359 | 360 | /*---------------------- (> 1025px) ---------------------*/ 361 | @media only screen and (min-width: 1025px) { 362 | 363 | body { 364 | font-size: 16px; 365 | line-height: 24px; 366 | } 367 | 368 | #background { 369 | width: 525px; 370 | } 371 | ul.sections > li > div.annotation { 372 | max-width: 525px; 373 | min-width: 525px; 374 | padding: 10px 25px 1px 50px; 375 | } 376 | ul.sections > li > div.content { 377 | padding: 9px 15px 16px 25px; 378 | } 379 | } 380 | 381 | /*---------------------- Syntax Highlighting -----------------------------*/ 382 | 383 | td.linenos { background-color: #f0f0f0; padding-right: 10px; } 384 | span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } 385 | /* 386 | 387 | github.com style (c) Vasily Polovnyov 388 | 389 | */ 390 | 391 | pre code { 392 | display: block; padding: 0.5em; 393 | color: #000; 394 | background: #f8f8ff 395 | } 396 | 397 | pre .hljs-comment, 398 | pre .hljs-template_comment, 399 | pre .hljs-diff .hljs-header, 400 | pre .hljs-javadoc { 401 | color: #408080; 402 | font-style: italic 403 | } 404 | 405 | pre .hljs-keyword, 406 | pre .hljs-assignment, 407 | pre .hljs-literal, 408 | pre .hljs-css .hljs-rule .hljs-keyword, 409 | pre .hljs-winutils, 410 | pre .hljs-javascript .hljs-title, 411 | pre .hljs-lisp .hljs-title, 412 | pre .hljs-subst { 413 | color: #954121; 414 | /*font-weight: bold*/ 415 | } 416 | 417 | pre .hljs-number, 418 | pre .hljs-hexcolor { 419 | color: #40a070 420 | } 421 | 422 | pre .hljs-string, 423 | pre .hljs-tag .hljs-value, 424 | pre .hljs-phpdoc, 425 | pre .hljs-tex .hljs-formula { 426 | color: #219161; 427 | } 428 | 429 | pre .hljs-title, 430 | pre .hljs-id { 431 | color: #19469D; 432 | } 433 | pre .hljs-params { 434 | color: #00F; 435 | } 436 | 437 | pre .hljs-javascript .hljs-title, 438 | pre .hljs-lisp .hljs-title, 439 | pre .hljs-subst { 440 | font-weight: normal 441 | } 442 | 443 | pre .hljs-class .hljs-title, 444 | pre .hljs-haskell .hljs-label, 445 | pre .hljs-tex .hljs-command { 446 | color: #458; 447 | font-weight: bold 448 | } 449 | 450 | pre .hljs-tag, 451 | pre .hljs-tag .hljs-title, 452 | pre .hljs-rules .hljs-property, 453 | pre .hljs-django .hljs-tag .hljs-keyword { 454 | color: #000080; 455 | font-weight: normal 456 | } 457 | 458 | pre .hljs-attribute, 459 | pre .hljs-variable, 460 | pre .hljs-instancevar, 461 | pre .hljs-lisp .hljs-body { 462 | color: #008080 463 | } 464 | 465 | pre .hljs-regexp { 466 | color: #B68 467 | } 468 | 469 | pre .hljs-class { 470 | color: #458; 471 | font-weight: bold 472 | } 473 | 474 | pre .hljs-symbol, 475 | pre .hljs-ruby .hljs-symbol .hljs-string, 476 | pre .hljs-ruby .hljs-symbol .hljs-keyword, 477 | pre .hljs-ruby .hljs-symbol .hljs-keymethods, 478 | pre .hljs-lisp .hljs-keyword, 479 | pre .hljs-tex .hljs-special, 480 | pre .hljs-input_number { 481 | color: #990073 482 | } 483 | 484 | pre .hljs-builtin, 485 | pre .hljs-constructor, 486 | pre .hljs-built_in, 487 | pre .hljs-lisp .hljs-title { 488 | color: #0086b3 489 | } 490 | 491 | pre .hljs-preprocessor, 492 | pre .hljs-pi, 493 | pre .hljs-doctype, 494 | pre .hljs-shebang, 495 | pre .hljs-cdata { 496 | color: #999; 497 | font-weight: bold 498 | } 499 | 500 | pre .hljs-deletion { 501 | background: #fdd 502 | } 503 | 504 | pre .hljs-addition { 505 | background: #dfd 506 | } 507 | 508 | pre .hljs-diff .hljs-change { 509 | background: #0086b3 510 | } 511 | 512 | pre .hljs-chunk { 513 | color: #aaa 514 | } 515 | 516 | pre .hljs-tex .hljs-formula { 517 | opacity: 0.5; 518 | } 519 | -------------------------------------------------------------------------------- /resources/parallel/docco.jst: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%= title %> 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 | <% if (sources.length > 1) { %> 14 |
    15 |
  • 16 | Jump To … 17 | + 18 |
    19 |
    20 |
    21 | <% for (var i=0, l=sources.length; i 22 | <% var source = sources[i]; %> 23 | 24 | <%= source %> 25 | 26 | <% } %> 27 |
    28 |
    29 |
  • 30 |
31 | <% } %> 32 |
    33 | <% if (!hasTitle) { %> 34 |
  • 35 |
    36 |

    <%= title %>

    37 |
    38 |
  • 39 | <% } %> 40 | <% for (var i=0, l=sections.length; i 41 | <% var section = sections[i]; %> 42 |
  • 43 |
    44 | <% heading = section.docsHtml.match(/^\s*<(h\d)>/) %> 45 |
    46 | § 47 |
    48 | <%= section.docsHtml %> 49 |
    50 | <% if (section.codeText.replace(/\s/gm, '') != '') { %> 51 |
    <%= section.codeHtml %>
    52 | <% } %> 53 |
  • 54 | <% } %> 55 |
56 |
57 | 58 | 59 | -------------------------------------------------------------------------------- /resources/parallel/public/fonts/aller-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/parallel/public/fonts/aller-bold.eot -------------------------------------------------------------------------------- /resources/parallel/public/fonts/aller-bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/parallel/public/fonts/aller-bold.ttf -------------------------------------------------------------------------------- /resources/parallel/public/fonts/aller-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/parallel/public/fonts/aller-bold.woff -------------------------------------------------------------------------------- /resources/parallel/public/fonts/aller-light.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/parallel/public/fonts/aller-light.eot -------------------------------------------------------------------------------- /resources/parallel/public/fonts/aller-light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/parallel/public/fonts/aller-light.ttf -------------------------------------------------------------------------------- /resources/parallel/public/fonts/aller-light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/parallel/public/fonts/aller-light.woff -------------------------------------------------------------------------------- /resources/parallel/public/fonts/roboto-black.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/parallel/public/fonts/roboto-black.eot -------------------------------------------------------------------------------- /resources/parallel/public/fonts/roboto-black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/parallel/public/fonts/roboto-black.ttf -------------------------------------------------------------------------------- /resources/parallel/public/fonts/roboto-black.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jashkenas/docco/6e69742d5496a1edb632d96f3d3e3580be8119f3/resources/parallel/public/fonts/roboto-black.woff -------------------------------------------------------------------------------- /resources/parallel/public/stylesheets/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v2.0.1 | MIT License | git.io/normalize */ 2 | 3 | /* ========================================================================== 4 | HTML5 display definitions 5 | ========================================================================== */ 6 | 7 | /* 8 | * Corrects `block` display not defined in IE 8/9. 9 | */ 10 | 11 | article, 12 | aside, 13 | details, 14 | figcaption, 15 | figure, 16 | footer, 17 | header, 18 | hgroup, 19 | nav, 20 | section, 21 | summary { 22 | display: block; 23 | } 24 | 25 | /* 26 | * Corrects `inline-block` display not defined in IE 8/9. 27 | */ 28 | 29 | audio, 30 | canvas, 31 | video { 32 | display: inline-block; 33 | } 34 | 35 | /* 36 | * Prevents modern browsers from displaying `audio` without controls. 37 | * Remove excess height in iOS 5 devices. 38 | */ 39 | 40 | audio:not([controls]) { 41 | display: none; 42 | height: 0; 43 | } 44 | 45 | /* 46 | * Addresses styling for `hidden` attribute not present in IE 8/9. 47 | */ 48 | 49 | [hidden] { 50 | display: none; 51 | } 52 | 53 | /* ========================================================================== 54 | Base 55 | ========================================================================== */ 56 | 57 | /* 58 | * 1. Sets default font family to sans-serif. 59 | * 2. Prevents iOS text size adjust after orientation change, without disabling 60 | * user zoom. 61 | */ 62 | 63 | html { 64 | font-family: sans-serif; /* 1 */ 65 | -webkit-text-size-adjust: 100%; /* 2 */ 66 | -ms-text-size-adjust: 100%; /* 2 */ 67 | } 68 | 69 | /* 70 | * Removes default margin. 71 | */ 72 | 73 | body { 74 | margin: 0; 75 | } 76 | 77 | /* ========================================================================== 78 | Links 79 | ========================================================================== */ 80 | 81 | /* 82 | * Addresses `outline` inconsistency between Chrome and other browsers. 83 | */ 84 | 85 | a:focus { 86 | outline: thin dotted; 87 | } 88 | 89 | /* 90 | * Improves readability when focused and also mouse hovered in all browsers. 91 | */ 92 | 93 | a:active, 94 | a:hover { 95 | outline: 0; 96 | } 97 | 98 | /* ========================================================================== 99 | Typography 100 | ========================================================================== */ 101 | 102 | /* 103 | * Addresses `h1` font sizes within `section` and `article` in Firefox 4+, 104 | * Safari 5, and Chrome. 105 | */ 106 | 107 | h1 { 108 | font-size: 2em; 109 | } 110 | 111 | /* 112 | * Addresses styling not present in IE 8/9, Safari 5, and Chrome. 113 | */ 114 | 115 | abbr[title] { 116 | border-bottom: 1px dotted; 117 | } 118 | 119 | /* 120 | * Addresses style set to `bolder` in Firefox 4+, Safari 5, and Chrome. 121 | */ 122 | 123 | b, 124 | strong { 125 | font-weight: bold; 126 | } 127 | 128 | /* 129 | * Addresses styling not present in Safari 5 and Chrome. 130 | */ 131 | 132 | dfn { 133 | font-style: italic; 134 | } 135 | 136 | /* 137 | * Addresses styling not present in IE 8/9. 138 | */ 139 | 140 | mark { 141 | background: #ff0; 142 | color: #000; 143 | } 144 | 145 | 146 | /* 147 | * Corrects font family set oddly in Safari 5 and Chrome. 148 | */ 149 | 150 | code, 151 | kbd, 152 | pre, 153 | samp { 154 | font-family: monospace, serif; 155 | font-size: 1em; 156 | } 157 | 158 | /* 159 | * Improves readability of pre-formatted text in all browsers. 160 | */ 161 | 162 | pre { 163 | white-space: pre; 164 | white-space: pre-wrap; 165 | word-wrap: break-word; 166 | } 167 | 168 | /* 169 | * Sets consistent quote types. 170 | */ 171 | 172 | q { 173 | quotes: "\201C" "\201D" "\2018" "\2019"; 174 | } 175 | 176 | /* 177 | * Addresses inconsistent and variable font size in all browsers. 178 | */ 179 | 180 | small { 181 | font-size: 80%; 182 | } 183 | 184 | /* 185 | * Prevents `sub` and `sup` affecting `line-height` in all browsers. 186 | */ 187 | 188 | sub, 189 | sup { 190 | font-size: 75%; 191 | line-height: 0; 192 | position: relative; 193 | vertical-align: baseline; 194 | } 195 | 196 | sup { 197 | top: -0.5em; 198 | } 199 | 200 | sub { 201 | bottom: -0.25em; 202 | } 203 | 204 | /* ========================================================================== 205 | Embedded content 206 | ========================================================================== */ 207 | 208 | /* 209 | * Removes border when inside `a` element in IE 8/9. 210 | */ 211 | 212 | img { 213 | border: 0; 214 | } 215 | 216 | /* 217 | * Corrects overflow displayed oddly in IE 9. 218 | */ 219 | 220 | svg:not(:root) { 221 | overflow: hidden; 222 | } 223 | 224 | /* ========================================================================== 225 | Figures 226 | ========================================================================== */ 227 | 228 | /* 229 | * Addresses margin not present in IE 8/9 and Safari 5. 230 | */ 231 | 232 | figure { 233 | margin: 0; 234 | } 235 | 236 | /* ========================================================================== 237 | Forms 238 | ========================================================================== */ 239 | 240 | /* 241 | * Define consistent border, margin, and padding. 242 | */ 243 | 244 | fieldset { 245 | border: 1px solid #c0c0c0; 246 | margin: 0 2px; 247 | padding: 0.35em 0.625em 0.75em; 248 | } 249 | 250 | /* 251 | * 1. Corrects color not being inherited in IE 8/9. 252 | * 2. Remove padding so people aren't caught out if they zero out fieldsets. 253 | */ 254 | 255 | legend { 256 | border: 0; /* 1 */ 257 | padding: 0; /* 2 */ 258 | } 259 | 260 | /* 261 | * 1. Corrects font family not being inherited in all browsers. 262 | * 2. Corrects font size not being inherited in all browsers. 263 | * 3. Addresses margins set differently in Firefox 4+, Safari 5, and Chrome 264 | */ 265 | 266 | button, 267 | input, 268 | select, 269 | textarea { 270 | font-family: inherit; /* 1 */ 271 | font-size: 100%; /* 2 */ 272 | margin: 0; /* 3 */ 273 | } 274 | 275 | /* 276 | * Addresses Firefox 4+ setting `line-height` on `input` using `!important` in 277 | * the UA stylesheet. 278 | */ 279 | 280 | button, 281 | input { 282 | line-height: normal; 283 | } 284 | 285 | /* 286 | * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` 287 | * and `video` controls. 288 | * 2. Corrects inability to style clickable `input` types in iOS. 289 | * 3. Improves usability and consistency of cursor style between image-type 290 | * `input` and others. 291 | */ 292 | 293 | button, 294 | html input[type="button"], /* 1 */ 295 | input[type="reset"], 296 | input[type="submit"] { 297 | -webkit-appearance: button; /* 2 */ 298 | cursor: pointer; /* 3 */ 299 | } 300 | 301 | /* 302 | * Re-set default cursor for disabled elements. 303 | */ 304 | 305 | button[disabled], 306 | input[disabled] { 307 | cursor: default; 308 | } 309 | 310 | /* 311 | * 1. Addresses box sizing set to `content-box` in IE 8/9. 312 | * 2. Removes excess padding in IE 8/9. 313 | */ 314 | 315 | input[type="checkbox"], 316 | input[type="radio"] { 317 | box-sizing: border-box; /* 1 */ 318 | padding: 0; /* 2 */ 319 | } 320 | 321 | /* 322 | * 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome. 323 | * 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome 324 | * (include `-moz` to future-proof). 325 | */ 326 | 327 | input[type="search"] { 328 | -webkit-appearance: textfield; /* 1 */ 329 | -moz-box-sizing: content-box; 330 | -webkit-box-sizing: content-box; /* 2 */ 331 | box-sizing: content-box; 332 | } 333 | 334 | /* 335 | * Removes inner padding and search cancel button in Safari 5 and Chrome 336 | * on OS X. 337 | */ 338 | 339 | input[type="search"]::-webkit-search-cancel-button, 340 | input[type="search"]::-webkit-search-decoration { 341 | -webkit-appearance: none; 342 | } 343 | 344 | /* 345 | * Removes inner padding and border in Firefox 4+. 346 | */ 347 | 348 | button::-moz-focus-inner, 349 | input::-moz-focus-inner { 350 | border: 0; 351 | padding: 0; 352 | } 353 | 354 | /* 355 | * 1. Removes default vertical scrollbar in IE 8/9. 356 | * 2. Improves readability and alignment in all browsers. 357 | */ 358 | 359 | textarea { 360 | overflow: auto; /* 1 */ 361 | vertical-align: top; /* 2 */ 362 | } 363 | 364 | /* ========================================================================== 365 | Tables 366 | ========================================================================== */ 367 | 368 | /* 369 | * Remove most spacing between table cells. 370 | */ 371 | 372 | table { 373 | border-collapse: collapse; 374 | border-spacing: 0; 375 | } -------------------------------------------------------------------------------- /resources/plain-markdown/README.md: -------------------------------------------------------------------------------- 1 | This is a simple plain-markdown template. 2 | 3 | It can be used to convert your docco output even further, 4 | for example to output to PDF via `LaTeX` with [`pandoc`][pandoc]. 5 | 6 | The resulting markdown uses code fences (```), 7 | which is compatible with Github- and pandoc-flavoured markdown. 8 | 9 | Example PDF output: 10 | 11 | # fetch some annotated source code 12 | cd /tmp 13 | wget https://raw.github.com/documentcloud/underscore/master/underscore.js 14 | # make plain with docco 15 | docco -l plain-markdown underscore.js 16 | cd ./docs 17 | # make PDF from plaintext with pandoc 18 | pandoc -f markdown docs/underscore.html -o underscore.pdf 19 | 20 | 21 | `pandoc` has a ton of options and output formats, you could also export to ePub, iBook- and Kindle-eBooks, Mediawiki markup, etc. [RTFM][pandoc-man]! 22 | 23 | An full-fledged scientific-looking PDF could use these options: 24 | 25 | pandoc -f markdown \ 26 | --table-of-contents \ 27 | --highlight-style=pygments \ 28 | -V title="Underscore.js" \ 29 | -V author="Prof. Dr. J. Ashkenas" \ 30 | -V date="$(date +%d-%m-%Y)" \ 31 | -V documentclass="book" \ 32 | --chapters \ 33 | -o docs/underscore.pdf \ 34 | docs/underscore.html 35 | 36 | 37 | This is as quick-and-dirty as the original docco, 38 | so there are some **bugs**: 39 | 40 | - The code blocks don't always fit on paper (if the lines are too long). This is a serious issue, but could be fixed "easily" in [pandoc's LaTeX template][] (where "easy" is relative, as always when dealing with LaTeX) 41 | 42 | - No syntax higlighting. Could maybe built into the template -- it would be just a matter of printing something like ```javascript as the start of each code fence. 43 | 44 | - The plaintext output file is markdown, but the filename has .html (not really important since it is just an intermediary file) 45 | 46 | 47 | 48 | [pandoc]: http://johnmacfarlane.net/pandoc/index.html 49 | [pandoc-man]: http://johnmacfarlane.net/pandoc/README.html 50 | [pandoc's LaTeX template]: https://github.com/jgm/pandoc-templates/blob/master/default.latex 51 | -------------------------------------------------------------------------------- /resources/plain-markdown/docco.jst: -------------------------------------------------------------------------------- 1 | <% for (var i = 0, l = sections.length; i<% var section = sections[i]; %><%= section.docsText %><% if (!(/^\s*$/).test(section.codeText)) { %> 2 | ```<%= section.codeText %>``` 3 | <% } %> 4 | <% } %> 5 | --------------------------------------------------------------------------------