Jetpack/SDK/Writing Documentation: Difference between revisions

no edit summary
No edit summary
Line 3: Line 3:
== Writing Documentation for the Add-on SDK ==
== Writing Documentation for the Add-on SDK ==
   
   
Documentation in the Jetpack SDK is a self-contained system within the SDK itself. All of the documentation is generated on the fly, via actual files located in the directory structure. SDK documentation is viewable either as source (at any time) or as a web page after the SDK has been activated and the "cfx docs" command has been run from the command line.
Documentation in the Add-on SDK is a self-contained system within the SDK itself. All of the documentation is generated on the fly from source files located in the directory structure. SDK documentation is viewable either as source (at any time) or as a web page after the SDK has been activated and the "cfx docs" command has been run from the command line.


The "cfx docs" command launches a small web server in order to render the documentation for human consumption. It relies on three things:
The "cfx docs" command launches a small web server in order to render the documentation in a browser. It relies on three things:
* That the documentation is written in [http://daringfireball.net/projects/markdown/ Markdown syntax]
* That the documentation is written in [http://daringfireball.net/projects/markdown/ Markdown syntax]
* That the API component is described in APIDoc syntax
* That the API components are described in APIDoc syntax
* That there are corresponding .js/.md files in the lib/docs directories (e.g. tabs.js/tabs.md)
* That there are corresponding .js/.md files in the lib/docs directories (e.g. tabs.js/tabs.md)


Line 79: Line 79:
If the component isn't nested like this, that means it's defined at module scope.
If the component isn't nested like this, that means it's defined at module scope.


=== <code>constructor</code>, <code>function</code>, and <code>method</code> Syntax ===
=== <code>constructor</code>, <code>function</code>, <code>method</code> ===


The syntax for <code>function</code> and <code>method</code> types is identical: the only difference is that <code>method</code> components are nested inside <code>class</code> or <code>property</code> components, whereas <code>function</code> components aren't.
The syntax for <code>function</code> and <code>method</code> types is identical: the only difference is that <code>method</code> components are nested inside <code>class</code> or <code>property</code> components, whereas <code>function</code> components aren't.
Line 170: Line 170:
  </api>
  </api>


=== <code>class</code> Syntax ===
=== <code>class</code> ===


<code>class</code> components don't have any special syntax, except that you can nest <code>constructor</code>, <code>method</code>, <code>property</code>, or <code>event</code> components inside them.
<code>class</code> components don't have any special syntax, except that you can nest <code>constructor</code>, <code>method</code>, <code>property</code>, or <code>event</code> components inside them.


=== <code>property</code> Syntax ===
=== <code>property</code> ===


<code>property</code> components indicate the data type of the property, enclosed in braces, immediately following the @property tag:
<code>property</code> components indicate the data type of the property, enclosed in braces, immediately following the @property tag:
canmove, Confirmed users
737

edits