[pmwiki-users] Setting an id-tag to a 2nd level heading and removing "name=" in anchor

Hans design5 at softflow.co.uk
Tue Mar 22 12:40:35 CDT 2011


Tuesday, March 22, 2011, 5:21:52 PM, Martin Kerz wrote:

> I need html that looks like this:

> <h2 id="heading">Heading</h2>

You need some kind of custom markup, as the !! markup does not
provide a name or id setting. Not sure how different from the standard
!, !!, !!!, etc. headings markup you like to go.

> The other (minor) problem I have is that whenever I add an anchor,
> the resulting html adds both the "name=" _and_ the "id=" tags to the
> anchor. Can I somehow avoid setting the "name=" tag?

define in config an alternative to the anchor markup:

## [[#anchor]]
Markup('[[#','<[[','/(?>\\[\\[#([A-Za-z][-.:\\w]*))\\]\\]/e',
 "Keep(TrackAnchors('$1') ? '' : \"<a id='$1'></a>\", 'L')");
function TrackAnchors($x) { global $SeenAnchor; return @$SeenAnchor[$x]++; }

I just removed the name='$1' from the standard anchor definition.


  ~Hans




More information about the pmwiki-users mailing list