DocTemplates are a few ways and ideas that help you create and improve documentation templates.

Method Template

  • Class/prototype: object [Depends on page layout. H2 could be used instead]
  • name of method: name
  • can tear (closured=yes,prototypical=no): tearable
  • short summary (around one sentence, if needed): summary
  • general description: description
  • usages: usage
  • see also: related

Method Usage Template

  • function signature: signature
  • return value: returns
  • parameter info: parameters
  • exceptions thrown: throws
  • description: description
  • Example: example

Parameter Template

  • name: name
  • types: types
  • default (when optional): default
  • description: description
  • object literal parameters: literal
    • Uses parameter template


|object = Color.prototype
|name = hue
|related = *[[#rotate]]
|usages = {{JSMethodUsage
 |signature = obj.hue()
 |returns = Number (0.0 - 1.0)
 |description = Extracts the [[Wikipedia:Hue|hue]] of the color stored in the color object.
 |example = <source lang="javascript">var col = dev.colors.parse('blue');
 |signature = obj.hue(value)
 |returns = Color
 |parameters = {{JSMethodParam
  |name = value
  |types = Number (0.0 - 1.0)
  |description = The new hue value to ''replace'' the current one
 |throws = RangeError: Too small/large value, NaN
 |description = Returns a new color object that contains a copy of the current color but with the new specified hue value.
 |example = <source lang="javascript">var col = dev.colors.parse('blue').mix('white', 75);
console.log(col, col.hue(0)); // Red shift</source>

Display is table:
name | object | tearable
short summary, if any
{Usage rows from usage template}
signature | return
{Parameter rows from parameter template}
name | type
{Sub-table for literal if needed}
{End parameter template}
{End usage template}
general description / longer examples / whatever

Class Template

  • name: name
  • summary of purpose/description: description
  • members of the constructor function (statics): statics
  • instance members of constructed objects: members
  • base class: base

Template generates name and general description followed by table of statics followed by table of members.

Class Member Template

  • name: name
  • unified function signature: signature
  • type (property): type [Default: Function]
  • short summary: summary

Template generates a table row containing name as link to section heading for method, signature next to it, optional short summary underneath.