Skip to content

Latest commit

 

History

History
311 lines (207 loc) · 7.04 KB

directive.rst

File metadata and controls

311 lines (207 loc) · 7.04 KB

Using Directives

Using automodule

Document nested elements from a module represented by a file or a index.js file within a folder:

example/
 |- index.js
 `- test.js

Two modules are available in the example above: example and example.test

rest

The available options are:

  • members:

    This option can be boolean if no arguments are given to indicate that all members should be documented, or a white list of member names to display.

  • skip-description:

    Indicate whether the module description should be skipped.

  • skip-data-value:

    Indicate whether data values within the module should be skipped.

  • skip-attribute-value:

    Indicate whether attribute values within the module should be skipped.

  • undoc-members:

    Indicate whether members with no docstrings should be displayed.

  • private-members:

    Indicate whether private members (with a name starting with an underscore) should be displayed.

  • module-alias:

    String element to replace the module name.

  • module-path-alias:

    String element to replace the module path.

  • force-partial-import:

    Indicate whether each import statement display within the module should be indicated with partial import.

configuration/js_module_options

Using autodata

Document a variable declaration using one of the following way:

  • :jsconst <Statements/const>
  • :jslet <Statements/let>
  • :jsvar <Statements/var>

Example:

/** PI Mathematical Constant. */
const PI = 3.14159265359;

rest

The available options are:

  • alias:

    String element to replace the data name.

  • module-alias:

    String element to replace the module name.

  • module-path-alias:

    String element to replace the module path.

  • force-partial-import:

    Indicate whether the data import statement display should be indicated with partial import if the data element is exported.

  • skip-value:

    Indicate whether data value should be skipped.

Using autofunction

Document a function declaration using one of the following way:

  • :jsfunction <Statements/function>
  • :jsfunction expression <Operators/function>
  • :jsarrow-type function <Functions/Arrow_functions>
  • :jsfunction* statement <Statements/function*>
  • :jsfunction* expression <Operators/function*>

Example:

/**
 * Return a distance converted from Meter to Miles.
 *
 * :param d: integer
 * :return: integer
 */
const toMiles = (d) => {
    return d * 0.00062137;
}

rest

The available options are:

  • alias:

    String element to replace the function name.

  • module-alias:

    String element to replace the module name.

  • module-path-alias:

    String element to replace the module path.

  • force-partial-import:

    Indicate whether the function import statement display should be indicated with partial import if the function element is exported.

Warning

These function declaration statements are not supported at the moment:

  • :jsFunction object <Global_Objects/Function>
  • :jsGeneratorFunction object <Global_Objects/GeneratorFunction>
  • :jsasync function <Statements/async_function>
  • :jsasync function expression <Operators/async_function>

Using autoclass

Document a class declaration using one of the following way:

  • :jsclass <Statements/class>
  • :jsclass expression <Operators/class>

Example:

/*
 * A Square class declaration.
 */
class Square extends Polygon {

    /** Square ID. */
    static name = 'Square';

    /** Construct the Square object. */
    constructor(length) {
        super(length, length);
    }

    /**
     * Compute and get the area from the square.
     *
     * :return: double
     */
    get area() {
        return this.height * this.width;
    }

    /**
     * Indicate whether a polygon is a square.
     *
     * :param polygon: :class:`Polygon` object
     * :return: boolean
     */
    static isSquare(polygon) {
        return (polygon.height === polygon.width);
    }
}

rest

The available options are:

  • members:

    This option can be boolean if no arguments are given to indicate that all members should be documented, or a white list of member names to display.

  • skip-constructor:

    Indicate whether the constructor method should be displayed if available.

  • skip-attribute-value:

    Indicate whether attribute values within the class should be skipped.

  • undoc-members:

    Indicate whether members with no docstrings should be displayed.

  • private-members:

    Indicate whether private members (with a name starting with an underscore) should be displayed.

  • alias:

    String element to replace the class name.

  • module-alias:

    String element to replace the module name.

  • module-path-alias:

    String element to replace the module path.

  • force-partial-import:

    Indicate whether the class import statement display should be indicated with partial import if the class element is exported.

Warning

The documentation of nested elements within a variable is not supported

Example:

var Rectangle = {
    constructor(height, width) {
        this.height = height;
        this.width = width;
    }
};

configuration/js_class_options

Using automethod

Document a method using one of the following way:

  • :jsgetter <Functions/get>
  • :jssetter <Functions/set>
  • :jsarrow-type method <Functions/Arrow_functions>
  • :jsstatic <Classes/static>

Example:

From the class example above, the static method isSquare would be documented as follow:

rest

Warning

These method declaration statements are not supported at the moment:

  • :jsmethod generator <Statements/function*>
  • :jsasync method <Statements/async_function>

Using autoattribute

Document a class attribute using one of the following way:

  • :jsstatic <Classes/static>

Example:

From the class example above, the static attribute name would be documented as follow:

rest

The available options are:

  • skip-value:

    Indicate whether attribute value should be skipped.