Aus SatriaWiki
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „A page can and should be divided into '''sections''', using the section heading syntax. For each page with more than three section headings, a table of contents (…“)
 
(kein Unterschied)

Aktuelle Version vom 11. August 2010, 12:57 Uhr

A page can and should be divided into sections, using the section heading syntax. For each page with more than three section headings, a table of contents (TOC) is automatically generated. This page attempts to explain the syntax of these elements. For information about how to name sections or how to use sections to structure articles, please read the Wikipedia:Guide to layout.

Creation and numbering of sections

Vorlage:For Sections are created by creating their headings, as below.

==Section==

===Subsection===

====Sub-subsection====

Please do not use only one equals sign on a side (Vorlage:Xt). This would cause a section heading to be as large as the page's name (title).

Heading names of sections (including subsections) should be unique on a page. Using the same heading more than once on a page causes problems:

  • An internal link (wikilink) to a section, in the form Vorlage:Xt, will only link to the first section on the page with that name, which may not be the intended target of the link. See also Linking to sections of articles.
  • When a section with a duplicate name is edited, the edit history and summary will be ambiguous as to which section was edited.
  • When saving the page after a section edit, the editor's browser may navigate to the wrong section.

Numbering

For registered users who use the preference setting Auto-number headings, sections are numbered in the table of contents and at beginning of each section heading.

Table of contents (TOC)

Vorlage:Shortcut Vorlage:For 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) the magic word __NOTOC__ (with two underscores on either side of the word) is added to the article

Positioning the TOC

When either __FORCETOC__ or __TOC__ (with two underscores on either side of the word) is placed in the wikitext, a TOC is added even if the page has fewer than four headings.

With __FORCETOC__, the TOC is placed before the first section heading. With __TOC__, it is placed at the same position where this code is placed. There may be some introductory text before the TOC, known as the "lead". Although usually a heading after the TOC is preferable, __TOC__ can be used to avoid being forced to insert a meaningless heading just to position the TOC correctly, i.e., not too low.

Floating the TOC

The TOC can, in some instances, be floated either right or left using Vorlage:Tl or Vorlage:Tl when it is beneficial to the layout of the article, or when the default TOC gets in the way of other elements. Before changing the default TOC to a floated TOC, consider the following guidelines:

  1. If an article will be adversely affected by the change, don't float the TOC.
  2. If floating the TOC, the TOC should be placed after the lead section of the wiki markup for consistency. Users of screen readers do not expect any text between the TOC and the first heading, and having no text above the TOC is confusing. See wikipedia:accessibility#Article structure
  3. When floating a TOC, check whether the page layout will be harmed if the TOC is hidden by the user.
  4. Long lists may create very long TOCs. The TOC should not be longer than necessary, whether it is floated or not. Vorlage:Tl can be used to reduce the length of the TOC by hiding nested subsections, rather than a floating TOC.
  5. The default TOC is placed before the first headline, but after any introductory text (unless changed by the page's editors). If the introductory summary is long enough that a typical user has to scroll down to see the top of the TOC, you may float the TOC so it appears closer to the top of the article. However, the floating TOC should in most cases follow at least the first paragraph of article text.
  6. Floating a wide TOC will produce a narrow column of readable text for users with low resolutions. If the TOC's width exceeds 30% of the user's visible screen (about twice the size of the Wikipedia navigation bar to the left), then it is not suitable for floating. (Percentages assume a typical user setup.) If text is trapped between a floating TOC and an image, floating can be cancelled at a certain text point, see Forcing a break.
  7. If the TOC is placed in the general vicinity of other floated images or boxes, it can be floated as long as the flowing text column does not become narrower than 30% of the average user's visible screen width.
  8. A left-floated TOC may affect bulleted or numbered lists.

The Vorlage:Tl template was proposed for deletion in early July 2005, but there was no consensus on the matter. The archive of the discussion and voting regarding this may be seen at Wikipedia:Templates for deletion/TOCright. The Manual of Style discussion can be found here.

Limiting the depth of the TOC

When an article or project page has a very large number of subsections, it may be appropriate to hide lower-level subsections from the TOC. You can specify a limit for the lowest-level section that should be displayed using Vorlage:Tlp, where n is the number of = signs that are used on each side of the lowest-level section header that should be displayed (e.g. 3 to show ===sections=== but hide ====sections====). The limit=n parameter can also be given to Vorlage:Tl or Vorlage:Tl the same way.

Linking to the TOC

The TOC is automatically generated with the HTML id "toc". You can make a link to it with [[#toc]]: