Difference between revisions of "Table of Contents - Mediawiki"

From Help Wiki
m
m (subst applied to Template:TwoColumn)
 
Line 1: Line 1:
{{TwoColumn|lead=
+
 
 +
<div class="container-fluid">
 +
<div class="row">
 +
<div class="col-md-8">
 +
<div class="lead">
 
A page can be divided into '''sections''', using the section header syntax. You can also use the [[Visual Editor - Mediawiki|Visual Editor]] for a quick and easy way to create section headings.
 
A page can be divided into '''sections''', using the section header syntax. You can also use the [[Visual Editor - Mediawiki|Visual Editor]] for a quick and easy way to create section headings.
|content=
+
</div>
 +
 
 
==Section Headings Syntax==
 
==Section Headings Syntax==
  
Line 38: Line 43:
  
 
More info: http://meta.wikimedia.org/wiki/Help:TOC
 
More info: http://meta.wikimedia.org/wiki/Help:TOC
|sidebar=
+
 
 +
 
 +
<!-- end col-md-8 -->
 +
</div>
 +
<div class="col-md-1"></div>
 +
<div class="col-md-3 sidebar">
 
{{Mediawiki Help}}
 
{{Mediawiki Help}}
 
{{GetHelp}}
 
{{GetHelp}}
}}
+
 
 +
<!-- end col-md-3-->
 +
</div>
 +
<!-- end row-->
 +
</div>
 +
<!-- end container-->
 +
</div>
 +
<!-- Generator=Template:TwoColumn -->
 +
__NOTOC__
 +
__NOEDITSECTION__
 
  [[category:Mediawiki]]
 
  [[category:Mediawiki]]

Latest revision as of 17:01, 14 August 2017

A page can be divided into sections, using the section header syntax. You can also use the Visual Editor for a quick and easy way to create section headings.

Section Headings Syntax

Sections are created by creating their headers, as below

==Section==

===Subsection===

====Sub-subsection====

Please do not use only one equals sign on a side (=text here=); this causes a title the size of the page name, which is taken care of automatically.

With the preference setting Auto-number headings sections are numbered.

Table of contents (TOC)

For each page with more than three headings, a table of contents (TOC) is automatically generated from the section headings, unless:

  • (for a user) preferences are set to turn it off
  • (for an article) in the edit box the magic word __NOTOC__ is added

Controlling the Auto TOC

With __FORCETOC__ or __TOC__ in the wikitext a TOC is added even if the page has fewer than four headings.

With __FORCETOC__ the TOC is put before the first section header. With __TOC__, it is put at the position of this code. This allows any positioning, also e.g. on the right, and in a table cell, and it also allows multiple occurrence, e.g. in every section (demonstrated on Section; however, this seems only useful if the sections are long, so that the TOCs take up only a small part of the total space.).

Thus there may be some introductory text before the TOC, known as the "lead". Although usually a header after the TOC is preferable, __TOC__ can be used to avoid being forced to insert a meaningless header just to position the TOC correctly, i.e., not too low.

User preferences can be set to number the sections automatically.


The Table of contents can be forced onto a floating table on the right hand of the screen with the code below

 {|align=right
  |__TOC__
  |}

More info: http://meta.wikimedia.org/wiki/Help:TOC