什么是docker,Static documentation generator based on docco



A documentation generator built on the foundations of Doccoand Docco-Husky.

The support available in Docco and Docco-Husky for larger projects consisting of many hundreds of script files was somewhat lacking, so I decided to create my own.

Take a look at this project's public pagefor an example of what it can do.


Simple: npm install -g docker


$ docker [options] [files ...]

Available options are:

  • -ior --input_dir: Path to input source directory. Defaults to current directory.
  • -oor --output_dir: Path to output doc directory. Defaults to ./doc.
  • -uor --updated_files: If present, only process files that hav been changed.
  • -cor --colour_scheme(yes, I'm British): Colour scheme to use. Colour schemes are as below.
  • -Ior --ignore_hidden: Ignore files and directories whose names begin with .or _.
  • -wor --watch: Keep the process running, watch for changes on the directory, and process updated files.
  • -sor --sidebar: Whether or not the sidebar should be opened by default in the output (defaults to yes, can be yes, no, true, false). Value disablewill disable the sidebar entirely in the output.
  • -xor --exclude: Comma-separated list of paths to exclude. Supports basic *wildcards too.
  • -nor --line-number: Include line numbers in the output (default is off)
  • -mor --multi_line_only: Whether to process onlymulti-line comments. (Defaults to false)
  • --js: Specify a comma-separated list of extra javascript files (relative to the current dir) to include
  • --css: Same as for --jsbut for CSS files
  • --extras: Comma-separated list of optional extras to activate (see below)

If no file list is given, docker will run recursively on every file in the current directory

Any of the files given can also be directories, in which case it will recurse into them.

Folder structure inside the input directory is preserved into the output directory and file names are simply appended .htmlfor the doc file


If you haven't installed with -gspecified, replace dockerwith something like $(npm root)/docker/dockerin all of the examples below.

Process every file in the current directory into "doc"

$ docker

Process files in "src" to "documents"

$ docker -i src -o documents


$ docker -o documents src


$ docker -o documents src/*

Note that in the first example, the contents of srcwill be mapped directly into documentswhereas in the second and third examples, the files will be created inside documents/src

Generate Docker docs

This is the command I use to generate this project's documentation.

  • Output to a directory on the gh-pagesbranch of this repo
  • Use the "manni" colour scheme
  • Show the sidebar by default
  • Ignore files starting with _or .
  • Only process updated files
  • Exclude the node_modules directory
  • Watch the directory for further changes as the code is updated.
  • Include the File Search extra
$ docker -o ../docker_gh-pages -c atelier-cave.light -s yes -I -u -x node_modules -w --extras fileSearch


The output of Docker is designed to be fairly lightweight, so doesn't include much other than the bare minimum to power the basic features. Optional extras like file searching and line jumping are therefore contained in there own files and can be turned on by a specific flag.

If you're viewing this on GitHub, take a look here; if you're looking at the Docker output, look here, for further explanation.

Colour Schemes

These are the styles available in highlight.js. See the highight.js demofor all available options. You should use the name of the CSS file for this option.

Important note

All files must be inside the input directory (specified by -i) or one of its descendant subdirectories. If they're not then various file paths in the output won't work properly and the file will probably get generated in the wrong place. Still, it's better than what it used to do, which was to get stuck in an infinite loop.

下一篇:使用rollup | vue cli3(Webpack) 搭建属于自己的组件库,(按需加载,多入口打包...)

扫码加入 JavaScript 社区



欢迎加入 JavaScript 社区