[dokuwiki] Re: invalid anchors

  • From: Andreas Gohr <andi@xxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Tue, 7 Feb 2006 22:31:19 +0100

On Tue, 07 Feb 2006 19:23:54 +0000
Chris Smith <chris@xxxxxxxxxxxxx> wrote:

> Great work so far on bring dokwiki's xhtml into line. :-)
> 
> I'd be inclined to go further to prevent non-unique ids.
> 
> e.g.
> 
> hd1_2_ways_to_do_it_better
> hd2_1st_way
> hd3_2nd_way
> hd4_3_more_ways_to_do_it_better
> hd5_1st_way
> hd6_2nd_way

hmm I don't like that. I want section ids as simple as possible to make
linking to them simple. And I want to keep section links as steady as
possible even when restructuring a document. I know this isn't
completely possible...

I though about it some time ago. I think it should work like this. When
the same headline is used multiple times then I'd like the following
ids:

headline
headline1
headline2

This makes sure headlines and ids still match in most cases and existing
links do not break. As long as the headlines are not duplicated in one
document you can move them around and change their level without
breaking any links.

> Perhaps even allowing the renderer to have a prefix specified, to
> allow  web pages with multiple wiki pages (e.g. sidebars or includes)
> to avoid  id collisions.

Hmm yes this could make sense. Using no prefix for the usual pages and
adding one for sidebars...

I had a look at how to implement all this but something was more
complicated than I first thought so I didn't do it right away.
Unfortunately I can't remember the problem :-(

Well for the problem of headings starting with digits... Hmm which chars
are allowed at start of an id?

Maybe we could add an underscore:

_3_ways_to_do_it

And then compensate for it when building the link:

[[foo#3 ways to do it]] would link to foo#_3_ways_to_do_it

as well as

[[foo#_3 ways to do it]] would.

Andi

Other related posts: