Blogator v1.2 released

Es
Blogator Project Releases

New release for Blogator that now includes a Table of Contents generator to use inside posts. In addition there was some major refactoring done in the code of the posts' output generation.

The new functionality takes the headings found inside the post's source HTML and, from these, creates a table of content in the form of an ordered list (<ol></ol>).

All the headings to be featured in the ToC are automatically given IDs so that they can be locally referenced with hyperlinks inside the ToC making the ToC entries clickable. Optionally, the headings featured in the ToC can have a numbering scheme applied to them.

Example

Let's say we only require 3 levels of headings to be featured starting from <h2></h2> up to <h4></h4> as H1 is used for other purposes:

<div class="auto-toc"></div> <h2>Heading A</h2> <h3>Sub-heading A</h3> <h4>Sub-sub-heading A</h4> <h2>Heading B</h2>
Code.1 HTML code snippet from a source post.

The settings in the config file are set as follows:

toc-auto-generate = 3; toc-level-offset = 1; toc-auto-numerate = true; toc-heading = "<h2>Table of Contents</h2>";

The ToC heading specified in the configuration file is inserted and the ToC is generated:

<div class="auto-toc"> <h2>Table of Contents</h2> <ol> <li><a href="#heading_1">1. Heading A</a></li> <li><ol> <li><a href="#heading_1_1">1.1 Sub-heading A</a></li> <li><ol> <li><a href="#heading_1_1_1">1.1.1 Sub-sub-heading A</a></li> </ol></li> </ol></li> <li><a href="#heading_2">2. Heading B</a></li> </ol> </div> <h2 id="heading_1">1. Heading A</h2> <h3 id="heading_1_1">1.1 Sub-heading A</h3> <h4 id="heading_1_1_1">1.1.1 Sub-sub-heading A</h4> <h2 id="heading_2">2. Heading B</h2>
Code.2 Modified code after generation of the ToC.

And that's it! Easy creation of tables of contents with just 1 div block declaration.