Jump to navigation Jump to search
This page is a translated version of the page Manual:Table of contents and the translation is 57% complete.

Other languages:
English • ‎dansk • ‎español • ‎français • ‎italiano • ‎polski • ‎português do Brasil • ‎русский • ‎中文 • ‎日本語
このページはウィキページの目次について扱っています。MediaWiki の技術的マニュアルの本文ページについては、Manual:コンテンツ を参照してください。



目次では、見出し内のHTMLは <sup>, <sub>, <i>, <b>, <span dir="rtl">, <span dir="ltr"> 以外はすべて取り除かれます。

The table of contents is not generated for section headings that are found within html tags (Manual:$wgRawHtml ).


Place __NOTOC__ anywhere you want on the page to hide its TOC.


目次の既定の位置は、最初の節見出しの直前です。 最初の見出しより前にあるテキストはすべて目次の前に置かれます。 それ以外の所に目次を配置するには、置きたい所でマジックワード __TOC__ を使います。

スキンは Extension:DeToc を使って、目次を無くしたりページの他のセクションに移動することができます。


もし、そのページが3つ未満のヘッダしか持っていなくても目次が欲しいなら、どこかに __FORCETOC__ と書いて標準位置に配置するか、置きたい場所に __TOC__ と書いてそこに配置するかの2つの方法があります。


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


目次に表示することができる最大のヘッダ数は、$wgMaxTocLevel によって定義されます。 To customize this for individual pages, the TOC can be enclosed in an element with class toclimit-<limit>, if the appropriate CSS rules are defined in the pages CSS.

実装例は、 MediaWiki:Gadget-site.css の中の Template:TOC とそれに関係するルールを参照して下さい。


普通、目次はセクションに自動で番号を付けます。 セクションのヘッダ自体に番号は付けられません。 目次の番号の付け方は、次のいくつかの方法でカスタマイズ出来ます。

  • MediaWiki:Common.css.tocnumber { display: none; } として定義された適切なクラスが存在する場合、目次での自動の番号付けをさせないことができます。

To do this selectively, a wrapper element can be placed around the TOC, as in <div class="noautonum">__TOC__</div> on the page, and .noautonum .tocnumber { display: none; } at MediaWiki:Common.css.

  • There is a user preference to also auto-number the section headings, at Preferences > Appearance > Advanced options > Auto-number headings. This can be set globally for the whole wiki by defining $wgDefaultUserOptions ['numberheadings'] = 1 in LocalSettings.php
    • 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.


Different languages have different ways of expressing TOCs and how its (sub)section numbering is done. Also, the different style guides of many languages differ in what style of TOC and TOC (sub)section numbering scheme they recommend for writers to use.

The different w:style guides of each language sometimes recommend different typographic conventions to follow.

It's important to note that most languages don't even have any style guide for writing in that language (and many languages don't have a written form entirely), so people usually use the most common style based on existing written convention (not prescribed, but simply 'standard' due to popular usage), which makes the written use of many languages have a sort of 'fluid' punctuation, spelling/orthography and even [personal changes of the very] grammar [of that particular language]. w:Westernization has influenced alphabet and non-alphabet writing systems, with many languages simply copying or being artificially converted to European-style typographic and w:punctuational conventions.

An example on how to change the style of a TOC to a localized one is given below:

Some languages put a dot after a (sub)section ordinal number, e.g. they do not use the following TOC style:

1 Section [1]
1.1 Subsection [1.1]
2 Section [2]
2.1 Subsection [2.1]
3 Section [3]
3.1 Subsection [3.1]
3.1.1 Subsubsection [3.1.1]
3.1.2 Subsubsection [3.1.2]

But use one like so:

1. Section [1.]
1.1. Subsection [1.1.]
2. Section [2.]
2.1. Subsection [2.1.]
3. Section [3.]
3.1. Subsection [3.1.]
3.1.1. Subsubsection [3.1.1.]
3.1.2. Subsubsection [3.1.2.]

(Notice the addition of dots after ordinal numerals before the section names!)

It's possible to produce that effect using w:CSS. Put the following CSS code in a shared CSS file of your MediaWiki installation and it should work:

.tocnumber:after { content: '.' }

where the symbol between the single quotation marks is the sign after a (sub)section number.

Also, see bugzilla:43494 and bugzilla:33450 for details on related i18n problems of TOCs.


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;.

実装例は Template:TOC を参照してください。


The behavior of the table of contents can be further adjusted using extensions.

一覧は Category:TOC extensions を参照してください。