Jump to content

Template:Documentation/Doc: Difference between revisions

From NixOS Wiki
DoggoBit (talk | contribs)
Created page with "This template is used for providing documentation for templates. It will "grab" the documentation from the <code>/Doc</code> subpage under the template it's used for. For example, using it on Template:Documentation would grab the documentation from Template:Documentation/Doc. == Usage == In general, the documentation should not be part of the template itself, thus you might want to do follow this general pattern: <pre> <includeonly> <!-- Template-specific co..."
 
DoggoBit (talk | contribs)
No edit summary
Line 1: Line 1:
This template is used for providing documentation for templates. It will "grab" the documentation from the <code>/Doc</code> subpage under the template it's used for. For example, using it on [[Template:Documentation]] would grab the documentation from [[Template:Documentation/Doc]].
This template is used for providing documentation for templates. It will "grab" the documentation from the <code>/Doc</code> subpage under the template it's used for. For example, using it on [[Template:Documentation]] would grab the documentation from [[Template:Documentation/Doc]].


== Usage ==
=== Usage ===


In general, the documentation should not be part of the template itself, thus you might want to do follow this general pattern:
In general, the documentation should not be part of the template itself, thus you might want to do follow this general pattern:
Line 9: Line 9:
   <!-- Template-specific code -->
   <!-- Template-specific code -->
</includeonly><noinclude>{{Documentation}}</noinclude>
</includeonly><noinclude>{{Documentation}}</noinclude>
</pre>
=== Writing the documentation ===
It is generally a good idea to write the documentation before applying this template to the page you are working on. In this way, you're avoiding displaying the missing red link for anyone while your work is in progress.
Keep in mind that all documentation headings should be one level lower than what you'd normally write, because the heading ''Template Documentation'' is a level 2 header already. For example, a documentation outline might be:
<pre>
Some introduction text...
=== Usage ===
Information about how to use your template...
=== Parameters ===
Available options and parameters...
=== Technical details ===
Any technical information about the template's implementation under the hood...
</pre>
</pre>

Revision as of 14:25, 5 June 2025

This template is used for providing documentation for templates. It will "grab" the documentation from the /Doc subpage under the template it's used for. For example, using it on Template:Documentation would grab the documentation from Template:Documentation/Doc.

Usage

In general, the documentation should not be part of the template itself, thus you might want to do follow this general pattern:

<includeonly>
  <!-- Template-specific code -->
</includeonly><noinclude>{{Documentation}}</noinclude>

Writing the documentation

It is generally a good idea to write the documentation before applying this template to the page you are working on. In this way, you're avoiding displaying the missing red link for anyone while your work is in progress.

Keep in mind that all documentation headings should be one level lower than what you'd normally write, because the heading Template Documentation is a level 2 header already. For example, a documentation outline might be:

Some introduction text...

=== Usage ===

Information about how to use your template...

=== Parameters ===

Available options and parameters...

=== Technical details ===

Any technical information about the template's implementation under the hood...