[pmwiki-users] Automatically add anchors to heading tags?

christian.ridderstrom at gmail.com christian.ridderstrom at gmail.com
Sun Jul 22 18:27:36 CDT 2007


On Sun, 22 Jul 2007, Patrick R. Michaud wrote:

>>> Is there a simple way to configure pmWiki such that all headings (H1, 
>>> H2, etc) are automatically generated with anchor tags so people can 
>>> link directly to a section or subsection?  (I believe MediaWiki has 
>>> this functionality by default.)
>>
>> Now officially a requested feature.  Vote / comment here:
>>
>>    http://www.pmwiki.org/wiki/PITS/00955
>
> I left some questions on the PITS page, but essentially:
>
> * What if the heading contains other markups, such as links
>  or wikistyles? Do we have to be smart enough to strip those
>  somehow before producing the heading anchor?
>
> * If a heading already has an anchor in it, should PmWiki
>  still generate yet another anchor for the heading?
>
> * Do we convert all punctuation that appears in the heading,
>  or just parens?

I tried finding the recipe 'visible anchors' that I thought I'd uploaded 
to the cookbook a long time ago (pmwiki v1), but maybe it got incorporated 
into John's PageToC.

I don't think it's a great idea to use the heading text to generate the 
label. My recommendation is to enumerate them instead. If we worry that an 
enumerated heading becomes incorrect if a heading is inserted before it, 
remember that a similar thing happens if you change the heading text.

/Christian

-- 
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr


More information about the pmwiki-users mailing list