Table of Contents based on headers?

1,691 views
Skip to first unread message

FLX

unread,
Oct 15, 2008, 7:52:43 AM10/15/08
to TiddlyWiki
Hello,

I'm currently creating a extensive tiddlywiki with long tiddlers with
headers (!Installation for example)
However, I would like tiddlywiki to build a automatic table of
contents based on the header.

For example, wikipedia does it. http://en.wikipedia.org/wiki/Linux
It creates a very neat "Contents" box based on the content headers.

Is this also possible for Tiddlywiki?

Thank you in advance,

Dennis

FND

unread,
Oct 15, 2008, 8:00:19 AM10/15/08
to Tiddl...@googlegroups.com
> I would like tiddlywiki to build a automatic table of
> contents based on the header.

Try this:
http://devpad.tiddlyspot.com/#DcTableOfContentsPlugin


-- F.

FLX

unread,
Oct 15, 2008, 8:29:34 AM10/15/08
to TiddlyWiki
Thank you FND, it works great. However, I noticed you use
TiddlerToCPlugin on your site for the table of contents. I like the
layout however. How do I get such a nice box and layout? Would you
happen to have any readymade css code for it?

Thanks again,

Dennis

FND

unread,
Oct 15, 2008, 9:08:25 AM10/15/08
to Tiddl...@googlegroups.com
> I like the layout [of TiddlerToCPlugin].

> How do I get such a nice box and layout? Would you happen to have
> any readymade css code for it?

Take a look at [[StyleSheetTableOfContents]]*; you probably just need to
replace ".ToC" with ".dcTOC" and ".ToC ol" with ".dcTOC ul".


-- F.


* http://devpad.tiddlyspot.com/#StyleSheetTableOfContents

FND

unread,
Oct 15, 2008, 9:54:54 AM10/15/08
to Tiddl...@googlegroups.com
> Thanks for the hints, FND. Its coming along nice now.

Glad it works.
However, please respond to the groups instead of to me directly, so any
progress is visible to everyone.

> I also added the "Tables of Content" text in a very crude way. i used:
> createTiddlyButton [...] I could use createTiddlyText for it, but I
> don't know how. Could you give an example.

Well, createTiddlyText takes two arguments; parent element and text:
createTiddlyText(c, "Table of Contents");

N.B.:
When modifying a plugin, you should change the metadata (version number,
possibly also name and author/contributors) to avoid confusion later on.

For future reference, coding-related questions are best discussed on the
developers group:
http://groups.google.com/group/TiddlyWikiDev/

> I currently use list-style-type: decimal; on the css of .dcTOC ul to
> create a nice numbered list. However, the subitems are numbers too.
> How can I make the subitems use a list type such as lower-alpha
> (a,b,c,d)? The subitems under that can be numbers again.

Use descendant selectors*:
ul { ... } /* level 1 */
ul ul { ... } /* level 2 */
ul ul ul { ... } /* level 3 */
...


-- F.


* http://www.w3.org/TR/CSS2/selector.html#q1

Reply all
Reply to author
Forward
0 new messages