table of contents plugin - for a tiddler

207 views
Skip to first unread message

Robert Mark Bram

unread,
May 5, 2008, 8:07:54 PM5/5/08
to TiddlyWiki
Hi All,

I am trying to find a way to add a table of contents (with links and
anchors) to any Tiddler for the headings in the Tiddler. I am using
TiddlyWiki v2.3.

It seems this plugin breaks TiddlyWiki:
http://devpad.tiddlyspot.com/#DcTableOfContentsPlugin
There is an error on the <<showtoc>> macro and whenever I reload the
Wiki, the page is almost blank! (Lucky I have the backup option turned
on.)

Saq Imtiaz apparently fixed DcTableOfContentsPlugin:
http://tiddlywiki.pastebin.com/f41f5e2e9
But I am not sure how to use the js code on that page.

The venerable FND's ToC plugin shows the table, but no links.
http://devpad.tiddlyspot.com/index.html#TiddlerToCPlugin

Does anyone have an update to this question of Tiddler Table of
Contents?

Thanks!

Rob
:)

Eric Shulman

unread,
May 5, 2008, 8:54:14 PM5/5/08
to TiddlyWiki
> It seems this plugin breaks TiddlyWiki:
> http://devpad.tiddlyspot.com/#DcTableOfContentsPlugin
> There is an error on the <<showtoc>> macro and whenever I reload the
> Wiki, the page is almost blank! (Lucky I have the backup option turned
> on.)

Actually, even though the above plugin shows an "error in <<showtoc>>"
when viewed at devpad.tiddlyspot.com, I just imported it into an empty
TW230 and, after the needed save-and-reload, it seems to work just
fine...

Can you provide a step-by-step description of exactly what did?
Perhaps you made some kind of error along the way...

-e
Eric Shulman
TiddlyTools / ELS Design Studios

Robert Mark Bram

unread,
May 5, 2008, 10:38:38 PM5/5/08
to TiddlyWiki
Hi Eric,

> Can you provide a step-by-step description of exactly what did?
> Perhaps you made some kind of error along the way...

- Backstage -> Import -> file: http://devpad.tiddlyspot.com/#DcTableOfContentsPlugin
- Select DcTableOfContentsPlugin
- Clear "Keep these tiddlers linked to this server so that you can
synchronise subsequent changes"
- Import
- Refresh the page and I see this:
http://www.box.net/shared/widoqyrk0w

It well and truly breaks Tiddly Wiki!

Rob
:)

Robert Mark Bram

unread,
May 5, 2008, 10:40:51 PM5/5/08
to TiddlyWiki
Sorry.. wrong link to the screen shot. This is the correct one:
http://www.box.net/shared/7ikscjdgcg

Eric Shulman

unread,
May 5, 2008, 11:34:40 PM5/5/08
to TiddlyWiki
- Backstage -> Import -> file: http://devpad.tiddlyspot.com/#DcTableOfContentsPlugin
- Select DcTableOfContentsPlugin
- Clear "Keep these tiddlers linked to this server so that you can
synchronise subsequent changes"
- Import
- Refresh the page and I see this:
http://www.box.net/shared/widoqyrk0w

It well and truly breaks Tiddly Wiki!

Hmm... the steps you took sound right. Still, as I noted before, I
was able to install the plugin into an empty TW230 document and it
worked without problems... so there must be something else going on
here...

Can you post the broken document somewhere that I can have a look?

-e

Eric Shulman

unread,
May 6, 2008, 12:29:15 AM5/6/08
to TiddlyWiki, lew...@gmail.com, FN...@gmx.net
> Hmm... the steps you took sound right. Still, as I noted before, I
> was able to install the plugin into an empty TW230 document and it
> worked without problems... so there must be something else going on
> here...
>
> Can you post the broken document somewhere that I can have a look?

Ah hah! I think I've sussed the problem...

Looking at the snapshot you posted
http://www.box.net/shared/7ikscjdgcg

It appears that you've used a heading element in the MainMenu (e.g., !
Tags).

When I added a heading to the MainMenu in my TW230 test document, it
throws an error:
w.tiddler has no properties

This is because the DcTableOfContentsPlugin redefines the formatter
for heading elements to automatically add the [top] link to each
heading.... but it only works if the heading is contained in a tiddler
that is displayed in the 'story column' (which is referenced in the
formatter code via the "w.tiddler" object). However, even though the
MainMenu content is defined in a tiddler, it is not actually rendered
as a tiddler. Rather, it is a special DIV element declared in the
PageTemplate. Thus, using a header in the MainMenu causes a fatal
error, since w.tiddler isn't defined when rendering that special DIV.

You can either:

A) workaround this error by omitting heading formats from the MainMenu

or

B) correct the plugin code by changing this line:
if (w.tiddler.isTOCInTiddler == 1) {
to
if (w.tiddler && w.tiddler.isTOCInTiddler == 1) {

I've tried (B), and it definitely fixes the problem.

I've CC'ed both Saq (lewcid) and Fred (FND) on this, so that they can
fix the problem in the official plugin distro.

enjoy,
-e





Robert Mark Bram

unread,
May 6, 2008, 3:19:06 AM5/6/08
to TiddlyWiki
Wow. Just wow. :)
Thanks Eric!

Rob
:)

FND

unread,
May 6, 2008, 3:45:55 PM5/6/08
to Tiddl...@googlegroups.com
> Ah hah! I think I've sussed the problem...

Thanks Eric. I'm pretty much swamped at the moment, so I don't know yet
when I'll have the time and nerve to review this - but it's on the list!

If I remember correctly, what prompted Saq to create a modified version
of Doug's plugin was that headings' font size became increasingly large,
due to changes in the formatter - so I'm a bit surprised it worked for
you on v2.3.

> Saq Imtiaz apparently fixed DcTableOfContentsPlugin:
> http://tiddlywiki.pastebin.com/f41f5e2e9
> But I am not sure how to use the js code on that page.

In order for JavaScript code to be processed by TiddlyWiki, it usually
needs to be in a tiddler tagged with "systemConfig".


-- F.

FND

unread,
May 12, 2008, 9:24:18 AM5/12/08
to Tiddl...@googlegroups.com
> I've CC'ed both Saq (lewcid) and Fred (FND) on this, so that they can
> fix the problem in the official plugin distro.

Sorry for the delay - I've uploaded the fixed version here:
http://devpad.tiddlyspot.com/#DcTableOfContentsPlugin

Note that this is not exactly the official plugin distro; since Doug
doesn't seem to maintain this anymore, I've added the updated version of
his plugin to my DevPad.


-- F.

Karl Arao - karlarao.tiddlyspot.com

unread,
Jun 18, 2015, 10:06:33 AM6/18/15
to tiddl...@googlegroups.com, Tiddl...@googlegroups.com, fn...@gmx.net

Hi Guys, 

I installed the DcTableOfContentsPlugin as instructed from the previous threads. And it worked.  

I'm currently using the tiddlyspot MonkeyPirateTiddlyWiki (MPTW) theme and now I'd like to put <<showtoc>> on all of my tiddlers. 

How can I do this with my current theme? 

Also how can I change the TOC to be box style given that I'm in MPTW theme? just like what's in http://devpad.tiddlyspot.com/#DcTableOfContentsPlugin



Thanks!

-Karl
Reply all
Reply to author
Forward
0 new messages