Jump to content

Manual:Section editing

From mediawiki.org

Section editing is the practice of editing a particular section on a page by clicking on the edit or edit source link next to a subheading.

This page is for the technical details of section editing and how to configure it. See Help:Section for the end-user documentation about the feature.

Existing sections

[edit]

When editing a section in the source editor, the URL contains section=n where n is an integer index to the section being edited. These are counted from 0 (but see #Lead section below for more about section 0). If you try to edit a section number that doesn't exist, you'll get an error message.

When editing a section, the edit summary field is pre-populated with a special section indicator, such as /* Existing sections */, which will be turned into a link when it's viewed in page history, diffs, etc.

When opening a section for editing in the VisualEditor , the whole page is opened for editing. The main difference between this and editing the whole page is that the edit summary is still pre-populated with the section name.

New sections

[edit]

It is possible to create a new section at the end of a page by adding section=new to the URL. This opens the normal editing form, with an additional text field above the page textbox (labelled 'Subject:'), into which the section title can be entered.

In addition, the normal edit summary field is hidden. It's not possible to add an edit summary when adding a new section, because the section title will be used (in fact, the 'Subject:' and 'Summary (?):' fields are internally the same). The phrase 'New section' will be added to the generated edited summary.

If the DiscussionTools extension is installed, adding a new section will not open the page editing form but instead direct you to a new comment form at the bottom of the page.

Lead section

[edit]

Page content that is before the beginning of the first section is called the "lead section" or "section zero". It can not be edited directly via the UI in most skins, but it is possible to manually change the edit URL to include section=0. Various Gadgets exist to make this easier, such as the edittop gadget.

Right-click to edit

[edit]

The Enable section editing by right clicking on section titles user preference (editsectiononrightclick, "0" by default) allows users to edit a section by right-clicking on the section heading. This feature requires JavaScript to be enabled.

Limitations

[edit]
  • The Page Previews feature of Extension:Popups may only show the part of the lead section, which might interfere with translation units if Extension:Translate is in use.
  • Wording or formatting can be more difficult to choose without content before or after the editable section.
[edit]

Section editing is a default feature of MediaWiki but can be disabled in a number of ways, as is explained below. Disabling is especially useful when a heading is created from within a template : the normal wiki section-edit would in this case edit the template code, which is normally counterintuitive to the user.

Historical note: In MediaWiki 1.23 and earlier there was a user preference for disabling the section editing links. This was removed with T54811.

Site or user stylesheets

[edit]

It is possible to use the global or personal stylesheets to remove the section editing links. The following CSS shoulg be added to MediaWiki:Common.css or Special:MyPage/common.css:

.mw-editsection {
    display:none !important;
}

Magic word

[edit]

The Magic word __NOEDITSECTION__ can be used to hide all section edit links on a particular page.

This magic word is transcludable, meaning that it can be embedded in a template in order to disable section editing on all pages where this template is used.

[edit]

CSS

[edit]

In Vector and other skins, the section link has the following CSS class:

.mw-editsection