Help:TOC

From FasciPedia
Jump to navigation Jump to search

By default, a table of contents (sometimes abbreviated to TOC) is automatically generated on a page when more than three section headings are used. Typically, the table reproduces and numbers these headings. All HTML in the headings is stripped in the TOC, except the following tags: ‎<sup>, ‎<sub> ‎<i> ‎<b> ‎<bdi> <span dir="rtl">, <span dir="ltr"> ‎<s>, ‎<strike> ‎<q> The table of contents is not generated for section headings that are found within html tags.

Hiding the TOC

Place __NOTOC__ anywhere you want on the page to hide its TOC. Using certain templates, such as the template:Compact ToC, will replace the regular Table of Contents functionality.

Positioning the TOC

The default position of the TOC is directly above the first section heading. Any prior text is placed before the TOC. To place it elsewhere, use the magic word __TOC__ at the preferred position on the page. A skin may remove or move the table of contents to another section of the page.

Adding the TOC

If you have three or fewer headings but want to have a TOC, write either the magic word __FORCETOC__ anywhere on the page to make it display at the default location, or __TOC__ at the preferred position.

Customizing the TOC

Width

An extenuating circumstance may require the width of a TOC width to be adjusted as a percentage of a page. For example: {{TOC left|width=30%}}

Auto-numbering

By default, the TOC automatically numbers the sections. The section headings themselves aren't numbered. This behavior of the table of contents can be customised in several ways:

To do this selectively, a wrapper element can be placed around the TOC, as in <div class="noautonum">__TOC__</div>.

There is a user preference to also auto-number the section headings, at Preferences > Appearance > Advanced options > Auto-number headings.

This setting can be overridden individually by users, by changing their preferences as described above, or by setting .mw-headline-number { display: none; } in their user style page. Administrators who lack server access can also override the setting for all users, if it is activated as mentioned above. This is done by using the same CSS code in the site's global common.css file.

To add a period to the automatically generated numbering do as described: https://stackoverflow.com/a/32347680/2275206

Floating

The TOC can be made to display as a floating element on the page, with text flowing around it. For this, enclose the TOC in an element with the CSS style float:left; or float:right;.