Template:Doc

Document how a template works and how to use it.

Usage
Create a subpage of the template called, place a   at the start of your documentation, and   at the end.

On the main template page add  on a newline at the end of the template.

Documentation subpages will automatically be added to Category:Documentation templates.

clear
If your main template page has floating content and you would like to stop it from going over the documentation, put  instead of   on your documentation page.

This is also useful for templates not using  tags, as it will put some space between the template and the documentation box.

nodoc=1
If a template has no documentation and you don't know how to use it, put  (or if the template needs clear as well,  ) instead of   on your documentation page.

The documentation's background will become red to make it more noticeable, and the page will be added to Category:Templates with no documentation.

baddoc=1
Similar to,   is used to mark templates that do have documentation, but it isn't very good. This can mean it doesn't have enough examples, doesn't explain all the functions properly, or doesn't explain the point of the template well.

The documentation's background will become yellow to make it more noticeable, and the page will be added to Category:Templates with bad documentation.

If both  and   are specified,   will be ignored.

Example
Let's say we want to add a template named. Its contents are the following:

Hello, !

To document how this template works for other editors, we create a subpage of it called, having the full article name of.

Within that subpage we'll put the following wikitext:

Say hello!

Usage
Say hello to a name.

Example
gives:

Hello, James!

Now that we've documented our  template, we need to reference our documentation from the template by adding it at the bottom.

Hello, ! &lt;noinclude&gt;

&lt;/noinclude&gt;

Now the template's documentation will be displayed any time the template is viewed!