Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Horizontal TOC/doc: Difference between revisions

Template page
Casiope (talk | contribs)
mNo edit summary
Casiope (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
This template lays out the table of contents in a horizontal list rather than a vertical one.
The template {{tlg|horizontal TOC}} lays out the table of contents in a horizontal list rather than a vertical one.


== Usage ==
== Usage ==


: <code><nowiki>{{horizontal TOC}}</nowiki></code>
: {{tlg|code=yes|nolink=yes|horizontal TOC}}


There is no need to specify <code><nowiki>__NOTOC__</nowiki></code>: this template handles that automatically.
There is no need to specify {{code|__NOTOC__}}: this template handles that automatically.
* [https://en.wikipedia.org/w/index.php?title=Template:Horizontal_TOC/doc&oldid=653960465 See example]


To hide the generated heading numbers, use:
* Use {{tlg|code=yes|nolink=yes|horizontal TOC|nonum{{=}}yes}} to hide the generated heading numbers.
: <code><nowiki>{{horizontal TOC|nonum=yes}}</nowiki></code>
* Use {{tlg|code=yes|nolink=yes|horizontal TOC|limit{{=}}2}} to limit the depth of the generated headings to the first headings only.
* [https://en.wikipedia.org/w/index.php?title=Template:Horizontal_TOC/doc&oldid=653960502 See example]
* Use {{tlg|code=yes|nolink=yes|horizontal TOC|align{{=}}center}} to float the table of contents to the center of the page.


To limit the depth of the generated headings to the first headings only, use:
For example, {{tlg|code=yes|nolink=yes|horizontal TOC}} produces: {{horizontal TOC}}
: <code><nowiki>{{horizontal TOC|limit=2}}</nowiki></code>
* [https://en.wikipedia.org/w/index.php?title=Template:Horizontal_TOC/doc&oldid=653960535 See example]


To float the table of contents to the center of the page, use:
== Parameters ==
: <code><nowiki>{{horizontal TOC|align=center}}</nowiki></code>
* [https://en.wikipedia.org/w/index.php?title=Template:Horizontal_TOC/doc&oldid=653960585 See example]


For example,
; {{para|nonum|{{var|yes}}}} : Hide the generated heading numbers.
<code><nowiki>{{horizontal TOC}}</nowiki></code> produces {{horizontal TOC}}
; {{para|limit}} : Limits the depth of subheadings shown. For instance, using {{para|limit|4}} will hide the fourth level and deeper subheadings in the hierarchy. And {{para|limit|2}} will hide all subheadings leaving only the main headings. This works by hiding the lower levels with CSS.
; {{para|align}} : Which side of the page to align the table of content to. Allowed values are left, right, center.
; {{para|clear}} : Align underneath floating images and tables or not. Allowed values are left, right, both, none.


== See also ==
[[Category:Templates]][[Category:Table of contents templates]][[Category:Templates documentation]]
 
{| class="wikitable center"
|-
! scope="col" colspan="2" | Parameter
! scope="col" | Description
! scope="col" | Example
! scope="col" | Type
! scope="col" | Status
|-
! scope="row" | No&nbsp;numbers
| <code><nowiki>no&nbsp;num</nowiki></code>
| style="text-align:left;" | Hide the generated heading numbers
| <code>yes</code>
| string
| optional
|-
! scope="row" | Limit
| <code><nowiki>limit</nowiki></code>
| style="text-align:left;" | Limits the depth of subheadings shown. For instance using limit=4 will hide the fourth level and deeper subheadings in the hierarchy. And limit=2 will hide all subheadings leaving only the main headings. This works by hiding the lower levels with CSS
|
| number
| optional
|-
! scope="row" | Align
| <code><nowiki>align</nowiki></code>
| style="text-align:left;" | Which side of the page to align the ToC to. Allowed values are left, right, center
| <code>align=left</code>
| string
| optional
|-
! scope="row" | Clear
| <code><nowiki>clear</nowiki></code>
| style="text-align:left;" | Align underneath floating images and tables or not. Allowed values are left, right, both, none
| <code>clear:both</code>
| string
| optional
|-
|}
 
[[Category:Templates documentation]]

Latest revision as of 16:40, 21 July 2020

The template {{horizontal TOC}} lays out the table of contents in a horizontal list rather than a vertical one.

Usage

{{horizontal TOC}}

There is no need to specify __NOTOC__: this template handles that automatically.

  • Use {{horizontal TOC|nonum=yes}} to hide the generated heading numbers.
  • Use {{horizontal TOC|limit=2}} to limit the depth of the generated headings to the first headings only.
  • Use {{horizontal TOC|align=center}} to float the table of contents to the center of the page.

For example, {{horizontal TOC}} produces:

Parameters

|nonum=yes
Hide the generated heading numbers.
|limit=
Limits the depth of subheadings shown. For instance, using |limit=4 will hide the fourth level and deeper subheadings in the hierarchy. And |limit=2 will hide all subheadings leaving only the main headings. This works by hiding the lower levels with CSS.
|align=
Which side of the page to align the table of content to. Allowed values are left, right, center.
|clear=
Align underneath floating images and tables or not. Allowed values are left, right, both, none.