JavaScript annotations generate code for documents

Source: Internet
Author: User

Later found that such a document is very inconvenient to view, and listen to our boss said Phper can generate their documents, I think JS will also have a, so ... You know... Through the @ Guangzhou ♂lxrmido know JSDoc, so GitHub down on down; Attached address: Https://github.com/jsdoc3/jsdoc
He can let your JS generate HTML documents, such as:

The code is as follows Copy Code

/**
 * opens a new window
 * @param {string} [url] connection
 * @param {object} [options] configuration parameter
 * @retu RN {Object} MSC object
 * @example
 * 1, Msc.open ("/"),
 * 2, Msc.open ("/", {
 * width:1000,
 * height:300
 *});
 */www.111cn.net
function open (URL, options) {
    var str = "";
    if (options) {
        options.height = options.height | | 420 ;
        options.width = options.width | | 550;
        options.left = Options.left | | ((screen.width-options.width)/2); The default is centered
        options.top = Options.top | | ((screen.height-options.height)/2); The default is centered

for (var i in options) {
str + = ', ' + i + ' = ' + options[i];
}
str = STR.SUBSTR (1);
};
window.open (URL, ' connect_window_ ' + (+new Date), str);
str = NULL;
return MSC;
};

Using JSDoc can be resolved into, file, method name, parameters, examples, return value author, and so on information, and have directory index and source code. It's pretty awesome. Figure:

And this is just the tip of her function, more multi-functional to your excavation, I also just know, do not dare to hide, so share!
Note: What questions can be answered Ah, we study/discuss
I was installed with the CNPM in node (NPM knows it all)
CNPM Install Jsdoc-g
Then use CMD to carry out the required directory, directly

JSDoc Xl.js
JSDoc Directory Name
Run, she will generate out folders in the same directory, and then you'll open it. Note: Your comments must go according to the standard, I used the sublime Docblockr PS: Standard annotation will make our future work more handsome more parameter description please see GitHub, or official website http://usejsdoc.org/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.