Help:Sections and Table of Contents

From Festipedia, hosted by the FR Heritage Group
Jump to navigation Jump to search

An article can be divided into sections using headings.

Headings

You type You get

==Level 1==
===Level 2===
====Level 3====
=====Level 4=====
======Level 5======

Level 1

Level 2

Level 3

Level 4
Level 5

The heading must appear at the start of the line. In most situations there should be no other text on the line.

It is possible to get a level 0 heading by putting a single = each side of the text (e.g. =Big heading=) but this will produce a heading the same size as the page title. Please do not use level 0 headings.

By default, headings are not numbered. You can change this in your preferences.

You can specify headings using HTML syntax but you should only do this in exceptional circumstances (e.g. when you need to use a particular background or text colour for the heading). Section editing and linking (as described below) work for headings specified in HTML as well as headings specified using wiki markup.

Section editing

Sometimes it can be useful to edit a single section of a page if you only want to alter that section. By default, each section has an [Edit] link on the right hand side of the page (although these are disabled for this page). You can edit the section by clicking on the link. This will allow you to edit only the selected section and its sub-sections. You can set your preferences to prevent the [Edit] links appearing.

It is also possible to edit a section by right-clicking on its title provided the relevant option is turned on in your preferences.

To prevent the [Edit] links appearing on a page regardless of user preferences, simply put __NOEDITSECTION__ anywhere on the page. This only turns off the links. It does not prevent section editing. Right clicking on the section title will still work (if enabled) and entering the appropriate URL will also work.

On talk pages, the + tab at the top of the screen allows you to add a new section to the page. This can be made to appear on other pages by typing __NEWSECTIONLINK__ anywhere on the page. Please note that you should only do this for pages that are talk-like in nature. When adding a section, you will not be asked for an edit summary. The heading for the new section will automatically be used as the summary.

Previews

When previewing a section edit, there may be some minor differences from the final page. Primarily:

  • If numbering of headings is enabled, the numbering will start from 1 on the preview instead of reflecting the position of the section on the full page.
  • Any image, floating table or similar on the right of a previous section which overflows into this section will not apppear.

Editing the page header

There is no link for editing the text before the first heading by default, although there is a gadget that you can enable in your preferences that will provide such a link. Alternatively, if you click on any [Edit] link, you will see a link similar to:

http://www.festipedia.org.uk/w/index.php?title=Help:Sections_and_Table_of_Contents&action=edit&section=4

in the address bar of your browser. If you change the last part to read "section=0" and click on the "Go to" button (the arrow to the right of the address bar in Internet Explorer), you will be able to edit the text before the first heading.

Templates

Any page may use templates which themselves may include headings. Clicking on such a heading will present you with the relevant section of the template for editing. Note that this will only allow you to edit the template. You will not be able to change the values of any parameters passed to the template. If you need to do that, you should edit the preceding section on the base page.

Page history

Section edits are marked specially in the page history. There is no separate history for sections. The only way of getting a separate edit history for a section is to move that section into a template. You should not do this unless the text appears on several pages.

Linking to sections

You can link direct to any section on a page. For example, you can link to the "section editing" heading on this page like this:

[[Help:Sections and Table of Contents#Section editing|editing sections]]

You can link to another section on the same page by using [[#section_name|description]]. To link to a section on another page, use [[page_name#section_name|description]]. You don't have to provide a descriptive label for these links but it is strongly recommended that you do as these links on their own look pretty ugly.

If you have several sections with the same name, e.g. "Test", you can link to them as "Test", "Test_2", "Test_3" and so on.

Linking to a section on another page should be used with care. Renaming a page creates a redirect page so that links still work. Renaming a section does not create a redirect. To make matters worse, "What links here" does not allow you to find out which pages link to a particular section and "Broken links" only lists pages with links to non-existent pages, not pages with links to non-existent sections.

Occasionally you may want to link to somewhere on a page where a header would be inappropriate. You can do this by using span or div, e.g. <span id="anchor"></span> or <div id="anchor"></div>. Note that this may not work on some older browsers.

Redirects and templates

Specifying that a redirect page goes to a particular section of another page has no effect - the page will always redirect to the head of the target page. However, linking to a section of a redirect page will link to that section on the target page.

Specifying a particular section when invoking a template has no effect whatsoever. The entire template will be included.

Table of contents

A table of contents is automatically generated for any page with more than 3 sections unless:

  • the user turns this option off in their preferences
  • the page includes the text __NOTOC__

Adding the text __FORCETOC__ or __TOC__ to a page forces the table of contents to appear regardless of the number of headings or any user preferences. Note that __FORCETOC__ and __TOC__ both override __NOTOC__, i.e. if either __FORCETOC__ or __TOC__ appears on a page, a table of contents will be added even if the page also contains __NOTOC__.

The table of contents will usually appear immediately before the first section. However, if you add __TOC__ to the page, the table of contents will appear at the position of that code. If __TOC__ appears several times on the page, the table of contents will only appear at the first __TOC__ marker.