Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.

API Docs Guidelines

Zeno Rocha edited this page Aug 15, 2013 · 12 revisions

All code should be properly documented using YUIDoc syntax, so when you are writing source code documentation, make sure that...

  • 1) Methods are described using simple present tense;

    Wrong:

     /**
      * Go to the next index.
      *
      * @method next
      */
    

    Right:

     /**
      * Goes to the next index.
      *
      * @method next
      */
    
  • 2) There's no <a> tag pointing to a broken url;

    Wrong:

     /**
      * Holds the page items as a NodeList. The list could be queried
      * from the DOM trough Widget HTML_PARSER or generated if
      * <a href="Paginator.html#config_total">total</a> attribute is specified.
      */
    

    Right:

     /**
      * Holds the page items as a NodeList. The list could be queried
      * from the DOM trough Widget HTML_PARSER or generated if
      * <code>total</code> attribute is specified.
      */
    
  • 3) Every description ends with a dot;

    Wrong:

     /**
      * A formatter function to format each pagination item
      *
      * @attribute formatter
      * @type Function
      */
    

    Right:

     /**
      * A formatter function to format each pagination item.
      *
      * @attribute formatter
      * @type Function
      */
    
  • 4) Every piece of code needs to wrapped into a <code> tag;

    Wrong:

     /**
      * Sets the activeIndex attribute to the previous index.
      *
      * @method _updateIndexPrev
      * @param options
      * @protected
      */
    

    Right:

     /**
      * Sets the <code>activeIndex</code> attribute to the previous index.
      *
      * @method _updateIndexPrev
      * @param options
      * @protected
      */
    

And remember you just need to follow a pattern :)