Difference between revisions of "Template:TOC"
Jump to navigation
Jump to search
(Fun with templates) |
(Moved documentation to /doc subpage) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
<div style="{{#if:{{{float|}}}|float:{{{float|}}};}}{{{style|}}}" {{#if:{{{depth|}}}|class="toclimit-{{#expr:{{{depth}}}+1}}"}}>__TOC__</div><noinclude> | <div style="{{#if:{{{float|}}}|float:{{{float|}}};}}{{{style|}}}" {{#if:{{{depth|}}}|class="toclimit-{{#expr:{{{depth}}}+1}} {{{class|}}}"}}>__TOC__</div><noinclude> | ||
{{documentation}} | |||
<!-- Add categories to the /doc subpage; interwikis go to Wikidata, thank you! --> | |||
! | |||
</noinclude> | </noinclude> |
Latest revision as of 15:57, 10 June 2023
This documentation is transcluded from Template:TOC/doc. (Edit | history)
Note to editors: Please don't categorize this template by editing it directly. Instead, place the category in its documentation page, in its "includeonly" section.
Note to editors: Please don't categorize this template by editing it directly. Instead, place the category in its documentation page, in its "includeonly" section.
Note: This template is used on a lot of pages. In order not to put too much load on the servers, edits should be kept to a bare minimum.
Please discuss proposed changes on the talk page first.
Editing a template causes all pages that use the template to be re-rendered. If the Template is used often, this can put a lot of load on the servers since it fills up the job queue. [statistics]
Please discuss proposed changes on the talk page first.
Editing a template causes all pages that use the template to be re-rendered. If the Template is used often, this can put a lot of load on the servers since it fills up the job queue. [statistics]
{{TOC}} Flexible meta-template to allow better placement of the Table of Contents.
Usage
It should only be used in cases where the TOC gets in the way of other content or is detrimental to the layout of the page; it should not simply be used for aesthetics since it tampers with the standard appearance of articles. See Floating the TOC for further guidelines.
TemplateData
This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. Click here to see a monthly parameter usage report for this template based on this TemplateData.
TemplateData for TOC
{
"params": {
"float": {
"label": "Float",
"description": "Floats the TOC either to the left (default) or right",
"type": "string"
},
"style": {
"label": "Style",
"description": "<div> style attribute",
"type": "string"
},
"depth": {
"label": "Depth",
"description": "Limits the depth of subheadings shown. For instance, using depth=4 will hide the fourth level and deeper subheadings in the hierarchy. And depth=2 will hide all subheadings leaving only the main headings. This works by hiding the lower levels with CSS. Valid values are 1 to 6.",
"type": "number"
},
"class": {
"label": "Class",
"description": "<div> class attribute",
"type": "string"
}
},
"description": "{{TOC}} allows the auto-generated \"Table of Contents\" for an article to be formatted/styled according to a few parameters.",
"paramOrder": [
"float",
"style",
"depth",
"class"
],
"format": "inline"
}