An useful tool for transfer code to document.
The source is available for download from
GitHub.
Alternatively, you can install using Node Package Manager (npm
):
npm install code2doc -g
code2doc -c code -d doc -p node.js -t default -h http://interface.example.com:8080
code2doc -c code -d doc -p php -t default -h http://interface.example.com:8080
code2doc -c code -d doc -p ./my_parsers/java -t ./my_templates/my_ui -h http://interface.example.com:8080
The code folder that you want to transfer.
The document folder that save the result.
The parser that you choose to analyse the codes. The default parser is node.js. The other choose is php. In addition, you can define the parser by yourself. If you want to use your parser, you can do it like this:
-p ./my_parsers/java.js
The template file that you choose to render the result. The default template file is bootstrap style. In addition, you can define the template file bye yourself. If you want to use your template file, you can do it like this:
-t ./my_templates/my_template
Notice: code2doc
just support swig
engine now, so you should define the extension name as .swig
.
Sometimes, your code will run at different hosts.
for the less modify, you can use the host
param to define the host.
It work like this:
/**
* interface1
*
* some description
* some description
* ...
*
* @interface {!host}module2/interface1
* @method post
* @param {get|int} get_param1 get param1
* @param {get|text} get_param2 get param1
* @param {post|text} post_param1 post param1
* @param {post|int} post_param2 post param1
* @param {post|file} file_param1 file param1
* @return {json|string}
*/
If you set the host param as https://app.my-web.com:8090/
,
the interface will be https://app.my-web.com:8090/module2/interface1