Template:Horizontal TOC/doc: Difference between revisions

From FasciPedia
Jump to navigation Jump to search
(Created page with "{{Documentation subpage}} <!-- Categories and interwikis go at the bottom of this page. --> {{Uses TemplateStyles|Template:TOC limit/styles.css|Template:Horizontal TOC/styles.css|Template:Horizontal TOC/horizontal-toc-no-parentheses.css|noprotcat=yes}} This template lays out the table of contents in a horizontal list rather than a vertical one. == Usage == <pre> {{horizontal TOC}} </pre> There is no need to specify <code><nowiki>__NOTOC__</nowiki></code>:...")
 
m (Text replacement - "ikipedia" to "i***edia")
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:
{{Uses TemplateStyles|Template:TOC limit/styles.css|Template:Horizontal TOC/styles.css|Template:Horizontal TOC/horizontal-toc-no-parentheses.css|noprotcat=yes}}
{{Uses TemplateStyles|Template:TOC limit/styles.css|Template:Horizontal TOC/styles.css|Template:Horizontal TOC/horizontal-toc-no-parentheses.css|noprotcat=yes}}


This template lays out the table of contents in a [[WP:HLIST|horizontal list]] rather than a vertical one.
This template lays out the table of contents in a horiz list rather than a vertical one.


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


To hide the generated heading numbers, use:
To hide the generated heading numbers, use:
Line 18: Line 18:
{{horizontal TOC|nonum=yes}}
{{horizontal TOC|nonum=yes}}
</pre>
</pre>
*[https://en.wikipedia.org/w/index.php?title=Template:Horizontal_TOC/doc&oldid=653960502 See example]
*[https://en.wi***edia.org/w/index.php?title=Template:Horizontal_TOC/doc&oldid=653960502 See example]


To suppress the parentheses around subsection lists, use:
To suppress the parentheses around subsection lists, use:
Line 31: Line 31:
{{horizontal TOC|limit=2}}
{{horizontal TOC|limit=2}}
</pre>
</pre>
*[https://en.wikipedia.org/w/index.php?title=Template:Horizontal_TOC/doc&oldid=653960535 See example]
*[https://en.wi***edia.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:
To float the table of contents to the center of the page, use:
Line 38: Line 38:
{{horizontal TOC|align=center}}
{{horizontal TOC|align=center}}
</pre>
</pre>
*[https://en.wikipedia.org/w/index.php?title=Template:Horizontal_TOC/doc&oldid=653960585 See example]
*[https://en.wi***edia.org/w/index.php?title=Template:Horizontal_TOC/doc&oldid=653960585 See example]


For country and state lists with flag icons, see these examples: [[Legality of cannabis by country]]. And: [[Legality of cannabis by U.S. jurisdiction]].
For country and state lists with flag icons, see these examples: [[Legality of cannabis by country]]. And: [[Legality of cannabis by U.S. jurisdiction]].
Line 105: Line 105:
<includeonly>{{Sandbox other||
<includeonly>{{Sandbox other||
<!-- Categories go here -->
<!-- Categories go here -->
[[Category:Wikipedia table of contents templates]]
[[Category:Wi***edia table of contents templates]]
}}</includeonly>
}}</includeonly>

Latest revision as of 13:08, 5 December 2022

Template:Documentation subpage .horizontal-toc-align-right { float: right; }

.horizontal-toc-align-left { float: left; }

.horizontal-toc-align-center { margin-left: auto; margin-right: auto; clear: none; }

.horizontal-toc-clear-right { clear: right; }

.horizontal-toc-clear-left { clear: left; }

.horizontal-toc-clear-both { clear: both; }

.horizontal-toc-clear-none { clear: none; }

This template lays out the table of contents in a horiz list rather than a vertical one.

Usage

{{horizontal TOC}}

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

To hide the generated heading numbers, use:

{{horizontal TOC|nonum=yes}}

To suppress the parentheses around subsection lists, use:

{{horizontal TOC|noparens=yes}}

To limit the depth of the generated headings to the first headings only, use:

{{horizontal TOC|limit=2}}

To float the table of contents to the center of the page, use:

{{horizontal TOC|align=center}}

For country and state lists with flag icons, see these examples: Legality of cannabis by country. And: Legality of cannabis by U.S. jurisdiction.

See also

This template lays out the table of contents in a horizontal list rather than a vertical one.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
No numbersnonum

Hide the generated heading numbers

Example
yes
Stringoptional
Limitlimit

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

Numberoptional
No parenthesisno_parenthesis

Separates entries by bullets, regardless of sub-sections.

Example
yes
Stringoptional
Alignalign

Which side of the page to align the ToC to. Allowed values are left, right, center

Suggested values
left center right
Example
align=left
Stringoptional
Clearclear

Align underneath floating images and tables or not. Allowed values are left, right, both, none

Suggested values
left right both none
Example
clear:both
Stringoptional
Linkslinks

Specify a list of links for the table of contents instead of the section links automatically generated by the TOC magic word

Example
* [[#Season 1|1]]
Stringoptional