hello friends! new(ish)!
Template:TOC limit: Difference between revisions
>Morpheus (Created page with "<noinclude> {{Template}} This template inserts a Table of Contents which omits subheadings beyond a certain depth. The table obeys the same layout rules as the <nowiki>__TOC_...") |
>Morpheus mNo edit summary |
||
Line 2: | Line 2: | ||
{{Template}} | {{Template}} | ||
This template inserts a Table of Contents which omits subheadings beyond a certain depth. The table obeys the same layout rules as the <nowiki>__TOC__</nowiki> [[WP:MAGIC|magic word]]. Omitted sections still have section edit links in the article body; the main use for this template is situations where you want section edit links for ease of editing but don't want to clutter the table of contents. | This template inserts a Table of Contents which omits subheadings beyond a certain depth. The table obeys the same layout rules as the <nowiki>__TOC__</nowiki> [[wikipedia:WP:MAGIC|magic word]]. Omitted sections still have section edit links in the article body; the main use for this template is situations where you want section edit links for ease of editing but don't want to clutter the table of contents. | ||
== Usage == | == Usage == |
Latest revision as of 15:17, 26 April 2016
Please do not experiment with this template; you could ruin all pages using this template. If you want to edit this template, copy the text to Template:Sandbox, edit and test it there, and copy it back when it works.
Feel free to voice your opinion regarding this template.This template inserts a Table of Contents which omits subheadings beyond a certain depth. The table obeys the same layout rules as the __TOC__ magic word. Omitted sections still have section edit links in the article body; the main use for this template is situations where you want section edit links for ease of editing but don't want to clutter the table of contents.
Usage
{{TOC limit}}
The template defaults to including only the first- and second-level headings, e.g. those numbered "1" and "1.1" in the TOC.
You can specify a different limit by adding a header level:
{{TOC limit|4}}
4 allows for third-level headings, e.g. "1.1.1", but omits any subheadings below that from the TOC.
TOC levels versus wikitext header levels
The heading levels in the TOC normally correspond to the header levels in the wikitext, so a "== Level-2 header ==" will normally generate the first-level ("1") TOC headings, a "=== Level-3 header ===" will normally generate the second-level ("1.1") TOC headings, and so on. This correspondence does not hold if the page contains "= Level-1 headers =" or skips header levels. For example, wikitext like this:
== Level-2 heading (A) == === Level-3 heading (B) === == Level-2 heading (C) == ====== Level-6 heading (D) ====== = Level-1 heading (E) = == Level-2 heading (F) == === Level-3 heading (G) ===
will generate a TOC like this:
Contents
|
Using {{TOC limit}} on this page would not hide header D, because even though it is a level-6 heading it is shown at the second level in the TOC. And it would hide header G even though it is a level-3 heading just like header B, because header G is shown at the third level in the TOC while header B is shown at the second level.