Loading...
 
Features / Usability

Features / Usability


Automatic Table of Contents Generation for All Wiki Pages (Maketoc on WYSIWYG pages Alternative)

posts: 19

Hey all,

Not sure if this is the best place to put this, but I figured I'd dump it for the world.

I wrote some javascript which automatically generates a table of contents for the headers on wiki pages (works tiki 9-11, should continue to work) and adds them to all wiki pages. Its generated via javascript, so you don't call it in your pages, but it will just add itself when the page loads (unless you tell it not to for a specific page).

It creates two table of contents, one which sits at the top of the page, and another which scrolls down with you and you can expand via mouseover.

Works well for both WYSIWYG and Tiki Editor pages, so you don't have to worry about maketoc not working for WYSIWYG. Designed to work for my environment, but should work well for others.

You can disable on a page by page basis if you want.

Lots of notes on how to implement and use in the script itself, but it involves adding a few lines of CSS to your theme.css and adding an entry to tiki-setup.php. Really easy to get running.

I hope someone finds it useful! (my first js :)

keywords: maketoc wysiwyg, tiki wiki table of contents, wysiwyg table of contents

EDIT: Updated Script so toc doesn't show up when printing a page though tiki-print.php (meaning you have print enabled for pages, and you click the print icon at the top of page to get to the print view). Grab autoToc_081513.js for this functionality.

EDIT: Fixed IE bug. New version is autoToc_092413.js







posts: 19

Ah, alright. I'd checked out with SVN and made the changes, but ran into a 403 error when I tried to commit them and didn't have time to troubleshoot it. Thanks for taking care of that.

Good to know about the tabs too, I'm pretty sure my local editor uses spaces, but commits should be fine bc my vim uses tabs.

And np! Its definitely a lot better now that you've done all sorts of tiki magic that I wouldn't have known how to! :-)


Page: 2/2