toc.js is a tool to help people who still believe vim is a great HTML editor. toc.js automates the creation of a Table of Contents. This is helpful the first time you have to add an entry to a numbered chapter set. The idea comes from various wiki implementations which allow a TOC to be dynamically generated based on page content. This is a very simple implementation of that logic in javascript. To use toc.js, insert the following line near the top of your page: Then add the following line at the position you want your TOC to appear:
Finally, add the following stanza at the beginning of each "chapter": where "anchor" is used to create the intra-page hyperlink "jump" and "Chapter Heading Text" is what should be displayed both in the TOC and at the beginning of the "chapter". The noscript tags allow for non-javascript browsers. The TOC is not generated but at least headings are still visible. Enjoy, Ben Klang