All Projects → btd → docco

btd / docco

Licence: other
Most advanced fork of original docco - documentaion generator

Programming Languages

javascript
184084 projects - #8 most used programming language

Docco - docco documentation generator

It is a rewritten from scratch original docco generator, why I decided to rewrite it:

  • Support of directories
  • Depends only from node and strong libraries, no process.exec
  • Support any language and any comments styles - multilines, onelines - just fill a config file and point the generator to it

You can see examples of projects that already use docco.

Example usage

Show help:

docco --help

Process one single file:

docco file.js

Will become a newly created file in current directory with name file.js.html and docco.css for its style. That is all. To specify output directory use -o option (strongly recommended for batch processing).

By default it uses C-style comments /*! comment */ and // ... \n. So I am sure you want to use another type of comments - fill language configuration file and specify it with -l option.

For example I have this configuration file:

[
{
	"lang": "css",
	"comments": [["/*!", "*/"]],
	"files": ["\\.css$"] 
},
{
	"lang": "javascript",
	"comments": [["/*!", "*/"], ["//", "\n"]],
	"files": ["\\.js$"] 
},
{
	"comments": [["/*!", "*/"], ["//", "\n"]],
	"files": [".*"] 
}
]

It is an array of objects. Each object has 3 properties: lang - it is highlight.js language for highlight, you can skip this argument and in this case will be used best matched, comments - it is obviously array or comments, each it is array with start and end, files - array of file patterns for this object configuration.

Example usage:

docco -l ./resources/languages.example.json ./lib/batch.js

Batch processing

I strongly recommend adding -o option for batch processing!!!

To unable batch processing you can do one of the following things:

  • Specify more then one file for processing:
docco -l ./resources/languages.example.json -o ./docs ./lib/batch.js ./lib/single.js
  • Specify directory or set of directories or files (the same as above but mixed).

  • Specify option -b

  • Specify option --batch-config <path to batch config>

First 3 cases uses default filters for directories - skip files which starts from .. Last case used when you want to specify your own filters.

Example of a batch config:

[
{
	"path": "./lib",
	"config": { },
	"filters": ["^\.[^\/].*", "\/\.[^\/]"]
}
]

So it is also array (you can add any numbers of entries) with objects: path path to entry (usually directory), config - it is a language configuration for this entry (see example above), filters - it is array of strings, which will be excluded while traversing path location recusivly.

For this package I generated the documantation with this command:

docco -o docs -l ./resources/languages.example.json --title "Docco - documentaion generator" ./lib

License

(The MIT License)

Copyright (c) 2012 Bardadym Denis <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].