User:Timeshifter/Sandbox196

Please do not edit this sandbox. Please use your own sandbox.

Edited excerpts from Template:Anchor/doc

Basic format
You can define one or more anchor names, separated by |. This can be useful for alternative spellings, such as "humor" and "humour."

In general, an anchor is placed at the end of a section header by substitution:

which will be saved in the article as:

Anchor names are case sensitive, so  and   are not equivalent. When making an anchor, in general capitalize the first letter of the anchor name, and follow the same capitalization guidelines as headers (see Manual of Style: Headers for more information).

Rationale for substitution in the header 
To show why substitution in the header is preferred, the following anchor is placed in the Basic format section header:

Since the anchor is actually used on this documentation page, the links, and  all work and can be tested to see the effect.

For contrast, an anchor named has also been placed underneath the Basic format section header and can be clicked to illustrate how this placement hides the section title when jumping to the linked target:

Another anchor named has been placed above the section header. This anchor does work correctly, but because the anchor is technically not in the section but before it, it makes editing counter-intuitive.

Anchors should also never be left unsubstituted within a section header, as this violates MOS:HEADINGS and causes technical complications.

Additional anchor added. Current header name
The link (and anchor link)  still works.

And here is the page source within that H2 tag:

Basic format      [ edit | edit source ]

   

Same additional anchor added. Current header name
The link (and anchor link)  still works. All the anchor links still work:









And here is the page source within that H2 tag:

Basic format   <span class="anchor" id="Basic_format"> <span class="anchor" id="Basic_format">   [ <a href="/w/index.php?title=User:Timeshifter/Sandbox196&amp;veaction=edit&amp;section=1" class="mw-editsection-visualeditor" title="Edit section: Basic format">edit</a> | <a href="/w/index.php?title=User:Timeshifter/Sandbox196&amp;action=edit&amp;section=1" title="Edit section: Basic format">edit source</a> ]

<span class="mw-headline" id="Basic_format"> <span class="anchor" id="Anchor_name_1"> <span class="anchor" id="Anchor_name_2"> <span class="anchor" id="Basic_format"> <span class="anchor" id="Basic_format">

When header changed to "Basic format. Test"
See old version: https://en.wikipedia.org/w/index.php?title=User:Timeshifter/Sandbox196&oldid=1157602043

This page version was after I had added and removed "Test" a couple times from the "Basic format" heading.

When on that old version with the heading named "Basic format. Test" you will see that the anchor link still works. All the anchor links still work on that old version, as does the new anchor:











And here is the page source within that H2 tag:

<span class="mw-headline" id="Basic_format._Test">Basic format. Test <span class="anchor" id="Anchor_name_1"> <span class="anchor" id="Anchor_name_2"> <span class="anchor" id="Basic_format"> <span class="anchor" id="Basic_format"> <span class="anchor" id="Basic_format._Test">

<span class="mw-headline" id="Basic_format._Test"> <span class="anchor" id="Anchor_name_1"> <span class="anchor" id="Anchor_name_2"> <span class="anchor" id="Basic_format"> <span class="anchor" id="Basic_format"> <span class="anchor" id="Basic_format._Test">

The last anchor was added by Mediawiki after I had added and removed "Test" a couple times from the heading.