[Pmwiki-users] Automatic page table of contents with [[toc]]

John Rankin john.rankin
Sun Nov 23 13:43:36 CST 2003

There has been some discussion in the past about creating a mini-toc
for a wiki page. 

Are there any volunteers who want to take this further??

We have been experimenting with this a bit for a couple of 
the wikis we use and came up with:

vanilla flavour
[[toc]], [[toc#]] or [[toc*]]
produces a numbered or bulleted list of references to the 
paragraph text following any ![[#anchors]] or :[[#anchors]]

For example it includes

!![[#anch01]]A heading

Q:[[#anch01]]A question

but not

[[#top]]This page is about ...

It uses styles to float the toc list to the right of the page.

hokey-pokey flavour
It looks for markup like

!!#A heading
Q:#A question

and turns the # into a [[#tocnn]] anchor

[[toc]] then searches for !# or :#

We thought of looking for !s and automatically inserting 
anchors and toc entries, perhaps based on whatever ! comes 
first. For example, if the first occurrence of ! markup is 
!!, make a toc of any other !! occurrences, but not ! or !!!.

The problem I see with this is what if an author inserts anchor
markup manually. 

Any thoughts on how a toc feature should work?

I am happy to release this to the cookbook, but would like some
volunteers to test it. We rely on other local customisations,
for example to make sure it copes with

!!#A WikiWord reference and '''very''' interesting idea

So I have to pull together a collection of stuff that works
with a standard pmwiki distribution.

John Rankin

More information about the pmwiki-users mailing list