Javascript documentation documentation standard and automatic generation of documentation in IDEs and exportable

5

Java has Javadoc, PHP has PHPDoc and other languages, has documentation standards. Which standard is most commonly used to document javascript , already integrated to IDEs, so that when using functions, it auto-complete the code and is there a way to generate automatic documentation based on code documentation only?

How to display documentation for third-party libraries, such as jQuery ?

    
asked by anonymous 11.02.2014 / 19:06

1 answer

10

To document Javascript, I recommend using the standard described in JSDoc, whose page with explanatory documentation is link . In addition to stating in detail a standard that IDEs like Netbeans and Eclipse understand, JSDoc also has a command-line tool that reads your code and converts it into a ready-to-use HTML manual.

As a quick example, look at the code below

/**
 * Esta é uma função de exemplo de uso de JSDoc
 * 
 * @example 
 *   exemplo(3, 5); // 8
 * 
 * @param   {Number} obrigatorio   Parametro obrigatório
 * @param   {Number} [opcional]    Parametro ocional. Note os '[ ]'
 * @returns {Number}
 */
function exemplo (obrigatorio, opcional) {
    var resultado = 0;
    resultado = obrigatorio + (opcional || 0);
    return resultado;
}

For Netbeans IDE 7.4, using the function will generate the following

In the case of Netbeans and other IDEs, see how to add your favorite library, for example jQuery, to a path where there is a documented file so that your IDE displays context documentation. That way you'll need to see Google less often for something that is already explained during use.

    
11.02.2014 / 19:06