查看“模板:TOC/doc”的源代码
←
模板:TOC/doc
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{documentation subpage}} {{Uses TemplateStyles|Template:TOC/limit-styles.css}} '''Tables of contents''' contain links to sections within an article, providing easy and automatic on-page navigation. <templatedata> { "params": { "limit": { "label": "Heading level limit", "description": "How many heading levels to show in the table of contents. The lower, the fewer headings are shown. Note that in articles, the main level for headings starts at 2 (the article title is H1, so limit=1 would generally show no headings at all).", "example": "2", "type": "number" }, "align": { "label": "Alignment", "description": "Whether to align the table of contents to the \"right\" or \"left\". The default is left.", "example": "right", "type": "string" } }, "description": "Template for changing the way the table of contents is rendered.\n" } </templatedata> ==Standard Tables of Contents== Articles will include a default table of contents when more than three section headings appear. The default table of contents will include all section headings and will appear just before the first section heading. By default, the table of contents will be left aligned. You may hide an individual table of contents when viewing an article by clicking the "hide" link in the table. Alternately, if you do not wish to see ''any'' tables of contents, you may deactivate their display entirely within the Misc tab of your [[Special:Preferences|user preferences]]. Simply uncheck the box next to "Show table of contents (for pages with more than 3 headings)" and no tables of contents will be displayed. ==Modifying the Table of Contents== Several [[Help:Magic_words|magic words]] and templates exist which modify the standard tables of contents. ===Removing the Table of Contents from an article=== To remove the table of contents from any article, simply add the magic word <nowiki>__NOTOC__</nowiki> anywhere within the article. It's usually not advisable to do so, unless you are manually providing an alternative table of contents, but in some cases it may make the page more usable (e.g. on your main page, or on a page that just contains a list of links and is therefore already a TOC, of sorts). ===Forcing and Moving the Table of Contents=== To force the table of contents to appear regardless of how many headings an article has, simply add the magic word <nowiki>__TOC__</nowiki> anywhere within the article. The table of contents will appear wherever you place the template, allowing you to move it up or down the page from its normal position. ===Changing the alignment of the table of contents=== To force the table of contents to appear on the right of a page, use the <nowiki>{{tocright}}</nowiki> template. The table of contents will appear wherever you place the template. To force the table of contents to float on the left of a page, use the <nowiki>{{tocleft}}</nowiki> template. The table of contents will appear wherever you place the template. Note that the text of the page will wrap around a floated table of contents, whereas the standard table does not allow text to appear to the right of the table and instead creates whitespace. ===Limiting the headings listed in a table of contents=== Section headings create a hierarchy. In this page's table of contents, note how Section 2, "Modifying the Table of Contents", contains several subsections. These subsections could also contain subsections of their own. It's possible to limit the depth of headings which are included in the table using the <nowiki>{{toclimit}}</nowiki> template. By setting a number value for <code>|limit=</code>, only headings of the specified level or greater will display. For example, <code><nowiki>{{toclimit|limit=2}}</nowiki></code> will include only level two headings (<nowiki>==Heading==</nowiki>), while <code><nowiki>{{toclimit|limit=3}}</nowiki></code> will include level three headings (<nowiki>===Heading===</nowiki>) as well as level two headings, and so on. Like the other TOC templates, <nowiki>{{toclimit}}</nowiki> will cause the table to appear wherever the template is placed on the page. Additionally, both <nowiki>{{tocleft}}</nowiki> and <nowiki>{{tocright}}</nowiki> support the use of the <code>|limit</code> variable. == See also == * [[Template:TOCright]] [[Category:Help{{#translation:}}]]
本页使用的模板:
模板:Documentation subpage
(
查看源代码
)
模板:Uses TemplateStyles
(
查看源代码
)
返回至“
模板:TOC/doc
”。
导航菜单
个人工具
登录
命名空间
模板
讨论
大陆简体
已展开
已折叠
查看
阅读
查看源代码
查看历史
更多
已展开
已折叠
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
笔记
服务器
数据库
后端
前端
工具
《To do list》
日常
阅读
电影
摄影
其他
Software
Windows
WIKIOE
所有分类
所有页面
侧边栏
站点日志
工具
链入页面
相关更改
特殊页面
页面信息