Jump to content

Template:Documentation: Difference between revisions

From The Perfect Tower II
Exe boss (talk | contribs)
Create template for wrapping template documentation; based on the output of mw:Template:Documentation
 
No edit summary
 
Line 1: Line 1:
<onlyinclude><div id="template-documentation" class="tpl-doc" style="
<onlyinclude><templatestyles src="Documentation/styles.css" /><div id="template-documentation" class="tpl-doc">
clear: both;
<div class="tpl-doc-header">
background-color: /*var(--background-color-neutral-subtle,*/ #f8f9fa /*)*/;
<div class="tpl-doc-heading">{{dt|{{SUBJECTSPACE}}|Content}} documentation</div>
color: /*var(--color-base,*/ #202122 /*)*/;
<div class="mw-editsection-like plainlinks"><!--
border: 1px solid /*var(--border-color-base,*/ #a2a9b1 /*)*/;
margin-top: 1em;
border-top-left-radius: 2px;
border-top-right-radius: 2px;
">
<div class="tpl-doc-header" style="
background-color: /*var(--background-color-neutral,*/ #eaecf0 /*)*/;
color: /*var(--color-base,*/ #202122 /*)*/;
padding: .642857em 1em .5em;
border-top-left-radius: 2px;
border-top-right-radius: 2px;
">
<div class="tpl-doc-heading" style="
display: inline-block;
font-size: 1.5em;
">{{dt|{{SUBJECTSPACE}}|Content}} documentation</div>
<div class="mw-editsection-like plainlinks" style="
display: inline-block;
line-height: 24px;
margin-left: 1em;
"><!--
-->&#91;[[:{{dt|{{{1|}}}|{{FULLPAGENAME}}/doc}}|view]]&#93; <!--
-->&#91;[[:{{dt|{{{1|}}}|{{FULLPAGENAME}}/doc}}|view]]&#93; <!--
-->&#91;[{{fullurl:{{dt|{{{1|}}}|{{FULLPAGENAME}}/doc}}|action=edit}} edit]&#93; <!--
-->&#91;[{{fullurl:{{dt|{{{1|}}}|{{FULLPAGENAME}}/doc}}|action=edit}} edit]&#93; <!--
Line 30: Line 9:
--></div>
--></div>
</div>
</div>
<div class="tpl-doc-content" style="
<div class="tpl-doc-content">
display: flow-root;
padding: .214286em 1em;
">
{{:{{dt|{{{1|}}}|{{FULLPAGENAME}}/doc}}}}
{{:{{dt|{{{1|}}}|{{FULLPAGENAME}}/doc}}}}
<div style="clear: both;"></div></div>
<div style="clear: both;"></div></div>
</div></onlyinclude>
</div></onlyinclude>

Latest revision as of 01:40, 7 October 2026

Template documentation

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 /doc subpage, 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.