Extension:Auto-Anchor

Introduction
One thing about wiki headers is that, with the following:

===Header Text More Text===

MediaWiki is smart enough to strip out all the markup and hyper-linking from the text to create an anchor with the name "Header_Text_More_Text." However, it's been found that sometimes this mechanism is desired outside the headers, because, although, it does a great job making destination anchors, one doesn't necessarily want every destination anchor showing up in the TOC. And though you can manually create the destination anchor like so:

Header Text More Text

Some of us are just plain lazy. This is where this simple little extension comes into play.

…==Usage==

Where count is 0 or any positive integer. It specifies the number of wiki-headers that already have "wikitext". This is needed because there no way for the extension to know what IDs are already in use. (See 7356.)

Examples
gives Runnin' Down A Dream where the ID of the surrounding span tag is Runnin.27_Down_A_Dream. So if I want to link to that section I can just copy the text and paste into a wiki-syntax link:

Link! Damn you!

yields Link! Damn you!.

Specifying count as "4"

gives the id as Runnin.27_Down_A_Dream_5 without changing the displayed text.

Don't Templates Like Anchor Already Do This?
The Anchor template doesn't strip out any markup. So if a template named Template:Anchor were used whose content is



using the above example like so

would give the id as .27.27.27Runnin.27_Down.27.27.27_.5B.5BA_Dream.5D.5D.

Known Issues

 * No guarantee of ID uniqueness.
 * Does not ensure the first character of the ID is a letter. Blocked by 4515.
 * Newlines as part of the input may result in overlapping HTML tags blocks.

Download instructions
Please cut and paste the code found below and place it in  and. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
To install this extension, add the following to LocalSettings.php: