Template:Documentation/doc
Shows a template's documentation in a box under the template: the content of its /doc subpage, with links to view, edit and see the history of that subpage, and to purge the page. Based on the output of mediawiki.org's Template:Documentation.
Usage
Put this at the end of the template, after its code:
<noinclude>{{Documentation}}</noinclude>
Then write the documentation on the template's /doc subpage, such as Template:Crafting/doc. On that subpage, categories for the template go inside <includeonly>, and categories for the subpage itself inside <noinclude>.
1: a different page to show instead of the/docsubpage, such as documentation shared by several templates.
The heading names the namespace: "Template documentation", or "Content documentation" in the main namespace. Lua modules don't need this template: Scribunto shows Module:Name/doc above the module's code by itself.