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

Mike Shanley thebarmy at omniversalism.com
Wed Jul 25 22:27:05 CDT 2007



John Rankin wrote:
> [[#h1.2.3]] = The 3rd H3 in the 2nd H2 in the 1st H1.
> [[#h6.0.1]] = The 1st H3 in the 6th H1. (the 0 is for a missing H2)
>
> That proposal is robust under some inserts and deletes, but 
> obviously not others.
>   
Dom added the h's to my suggestion... and I've been trying to figure out 
the simplest way to avoid all this link-confusion in one fell swoop 
since then.

I really, really, really don't like the idea of using the titles as 
anchors, because of how much you lose.

Here's an idea... A wikipage, say, Site.TOC, organized AS a TOC:
*![[Group.Page#h1 | A Good Header]]
...
**!!![[Group.Page#h6.3a.1 | Another One]]
**!!![[Group.Page#h6.3a.2 | A Keeper]]*

So when a page is saved, this file is referred to.
------If a heading is added, so is a new reference (see the 'a' above).
------If the heading is deleted, the reference is deleted also.
------If the heading is changed (I don't know how to easily check this), 
the reference is updated, but the anchor kept.
------If the anchor is deleted, it is added again.
**
Sort of like a Recent Changes for the whole site! I think this takes 
care of most of the problems, with the added bonus of a perfect TOC. 
Even better- you can use (:include to add just the sections you want to 
another page... However, it does require editing/searching TWO pages 
every time you edit ONE.

Just an idea, anyway.

-- 
        ~Mike Shanley~




More information about the pmwiki-users mailing list