User:Dovid/Sandbox/Template:Heading anchor

Example: Results in: Which includes anchor links to automatically provided by wiki software), as well as to, , and , to keep older links to the section working.

Where headingLevel (required) is a number indicating the heading starting with 1 (template adds extra heading level per wiki standards, so 1 is really ==Heading2==, 2 is really ==Heading3==, etc.). The currentHeading (required) is the content of the heading. oldHeading1 (optional) is the previous heading text, and will become an anchor for old section links, as will any additional parameters, up to seven old values.

This template works much like Template:Headinganchor but accepts a first parameter for heading level. Otherwise, they perform identically.

The purpose of the template is to make it easy to change the text of a heading or subheading. WikiPedia guidelines call for adding an anchor (e.g., use the Anchor template or equivalent), but this simplifies it.

Note that the template does not actually have to start at the beginning of a line which is normally a requirement of headings. It includes its own line break, which is necessary to support the anchors.

Edit link issue
It is important to note that section edit links will not display for section titles that are displayed via this template. This will not prevent section editing, but will require editing the section using one of the following:
 * Edit of the page instead of the section; page edits always include the section in editing
 * Edit of a higher level section; this automatically includes the smaller section
 * Editing the section via a section edit URL (which may be impractical)

Note that the Visual Editor UI does not distinguish between section edits and page edits, so there is no UI difference when using the Visual Editor. However, a majority of editors continue to use the older wiki markup editor, for whom this will remain more of an issue. that is because in the wiki markup editor, sections are harder to find within the full document text.

Whether the problem above precludes use of the template in a particular situation, is up to the individual editor. A guideline to follow might be:
 * When an article is very long, and the template is used for a main heading or heading within a long section, the lack of section edit links will be disconcerting to some users, since the next higher edit link may be far away, and the section content will be hard to find in the wiki markup editor
 * For short or medium length articles, or subsections within short or medium length main sections, the lack of an edit section link is often not a problem