Loading...
 

PluginAutoTOC


New in Tiki23, this plugin allows to automatically generate a table of contents (TOC) in a wiki page. It permits to leverage the Auto TOC feature, with more flexibility on a page per page basis.
Its use is relatively simple, you just have to add its syntax code in a wiki page in which headings are located (tag H1 to H6).

This supercedes MakeTOC.
This is different than PluginToc, which is related to Wiki Structures.

Parameters

Display a Table Of Contents in a wiki page
Introduced in Tiki 23. Required parameters are in bold.
Go to the source code
Preferences required: wikiplugin_autotoc

Parameters Accepted Values Description Default Since
activity yes
no
Determine if the Table Of Contents will appear in the active page or not. yes 23.0
title Title for the Table Of Contents 23.0
offset int Offset of Table Of Contents. Offset default value is 15 15 23.0
align right
left
page
Position of the Table Of Contents, either right, left, page ("right" is the default and "page" will display the table of contents where it is placed in the wiki page.). right 23.0
levels text
separator: :
Specify which levels you want to see in the TOC. Levels are integers (1 to 6) separated with colon. Example : levels="1:2:3" to show only level 1, 2 and 3 headers. 23.0
mode off
inline
Change the display of the Table Of Contents for wiki pages to inline. off 23.0
tabs no
yes
Determine if the table of contents includes the content of Tabs plugin or not. no 25.0
tabset_names text
separator: ,
If tabs = yes, determine the Tabset names that uses the plugin. Use comma separator. Example : tabset_names="tab1,tab2,tab3" to show only the headers included in the tab1, tab2 and tab3 25.0
tabset_panes text
separator: ,
If tabs = yes, determine the Tabset panes that uses the plugin. Tabset panes are integers (1 to x) separated with comma. Example : tabset_panes="1,2,3" to show only 1, 2 and 3 headers of selected tabs names 25.0


Enabling/Disabling

To enable/disable PluginAutoTOC, go to Control Panels » Main Features » Edit and Plugins, then check "Experimental" option in "Preference Filters". Please, see the screenshot below :

PluginAutoTOC Enabling/Disabling
Click to expand

Usage

The plugin settings offer more ways to work with the table of contents: make it visible or not, position it on the left or right side of a wiki page, hide the headings of your choice, etc.

Activity

Is the only mandatory parameter. Its possible values are "yes/no", yes to display the table of contents and no to not display it.
Note: When you add the PluginAutoTOC to a page that contains a table of contents generated by the Auto TOC feature, the latter will be replaced by the one generated by the PluginAutoTOC.
Example:
The code below will add a table of contents to the right of a wiki page if there are headings (H1 to H6).

Copy to clipboard
{autotoc activity="yes"}

Align

Allows you to add a TOC either to the right, or left, or at the same position where will be placed the Plugin.
Note : By default the table of contents will be added to the right of the page.

Examples :

1. Align the TOC to the right of wiki page

This code
Copy to clipboard
{autotoc activity="yes"}
or
Copy to clipboard
{autotoc activity="yes" align="right"}


will produce this :

PluginAutoTOC Align right
Click to expand


2. Align the TOC to the left

Copy to clipboard
{autotoc activity="yes" align="left"}

Using this code above, you will get a result like this one :

PluginAutoTOC Align left
Click to expand


3. Place the TOC in the page
When you give the value "page" to the parameter "align", the table of contents is shown at the place where you put the Plugin in the page.

Copy to clipboard
{autotoc activity="yes" align="page"}

With the previous code, you will have a result like this one:

PluginAutoTOC Align page
Click to expand

Title

This parameter allows to add a title to a table of contents only when the value of the parameter align="page", in other cases the title will not be displayed.

Example

Copy to clipboard
{autotoc activity="yes" align="page" title="THIS IS A TITLE"}

Will produce a result like this :

PluginAutoTOC parameter title
Click to expand

Offset

Adds a space at the top of the table of contents. The value is expressed in pixels. This parameter works only when placing the TOC on the left or right side of the page, not when the TOC is in the content of the page.

Examples

1. A table of contents with 150px offset

Copy to clipboard
{autotoc activity="yes" offset="150"}

The code below will display a table of contents like this one :

PluginAutoTOC example 150px offset
Click to expand


2. A table of contents with 50px offset

Copy to clipboard
{autotoc activity="yes" offset="50"}

The code below will display a table of contents like this one :

PluginAutoTOC example 50px offset
Click to expand

Levels

Allows to display in the table of contents only the levels of the headings indicated as value of the parameter. When there is more than one, they are separated by ":".

Example

Copy to clipboard
{autotoc activity="yes" levels="3"}
will only display level 3 headings as shown in the screenshot below :
PluginAutoTOC parameter levels
Click to expand

Mode

This parameter should allow the extension of the headings of the table of contents without scrolling the page. This parameter does not work as expected.

Syntax :

This code :

Copy to clipboard
{autotoc activity="yes" mode="inline"}

Should allow the extension of headings.

And this code :

Copy to clipboard
{autotoc activity="yes" mode="off"}

Resets the extension of the titles that occurs only by scrolling the page.

Combinations

You can combine several parameters at once.

Examples :

This code :

Copy to clipboard
{autotoc activity="yes" align="page" title="Table of contents" levels="3"}


will produce a table of contents only with level 3 titles in the wiki page with the title Table of contents :

PluginAutoTOC example 1
Click to expand


This code:

Copy to clipboard
{autotoc activity="yes" align="left" levels="2:3" offset="130"}


will produce a table of contents only with level 2 and 3 headings in the wiki page with a 130px space above :

PluginAutoTOC example 2
Click to expand

Commits

https://sourceforge.net/p/tikiwiki/code/77744
https://sourceforge.net/p/tikiwiki/code/77745

List Slides