It's better when it's simple

User Tools

Site Tools


TOC Tweaking Assortment Plugin

Compatible with DokuWiki

  • 2017-02-19 "Frusterick Manners" yes
  • 2016-06-26 "Elenor Of Tsort" yes
  • 2015-08-10 "Detritus" yes
  • 2014-09-29 "Hrun" yes

plugin Collection of syntax components to tweak table of contents (TOC) for specific pages. Allow to tune TOC property: a) initial toggle status, b) top and max level of headings, c) position with css class.

Last updated on
Syntax, Action
Conflicts with
inlinetoc, toc, tocafterheadline

Similar to inlinetoc, toc, tocafterheadline

Tagged with toc


Install the plugin through the Extension Manager or Plugin Manager using the download URL above, which points to latest version of the plugin. Refer to plugin installation instructions.


1. Set the TOC initially closed

  • The TOC box will be initially closed state (in case the TOC is displayed in the page). This is a kind of control macro without creating any output itself.

2. Set top and max level of headings displayed in the TOC

~~TOC:2-4 ~~
  • Control the content of the TOC for the page. There are two numeric parameters: toptoclevel and maxtoclevel repectively.
  • Above example will exclude the page title (i.e. the first level 1 heading) from the TOC. Headings from level 2 to 4 included in the automatically generated Table of Contents.
  • You can tweak either top or max level of headings, for example:

3. move TOC position

  • Move/slide the TOC box placed at top right corner to anywhere in the page. Exactly, the TOC position is changeable only vertically in the page because the macro {{TOC}} in the Wiki text is to be rendered as same as original TOC html. Maybe useful if you want to place the TOC box after the second heading in order to avoid confliction with the tags line.
  • You can add css class to the TOC div box identifed with #dw__toc. Above example will apply class name “wide” to the TOC box, which is then identified as #dw__toc.wide, and the TOC will be displayed with 100% width in the page. “wide” class is defined in style.css of this plugin.
{{TOC:2-3 wide}}
  • You may give both class and heading levels parameter in this syntax.

4. inline TOC

{{INLINETOC:width18 3-4}} 
  • This syntax renders TOC of a page inside the page content. “width18” class is defined in all.css of this plugin.

Configuration and Settings

The plugin can be configured with the configuration manager in the admin menu.

tocPosition change always auto TOC position for normal pages
0: default(top-right)
1: after First heading
2: after First Level 1 heading
3: disable Auto-TOC. To show TOC, you need to use {{TOC}} or {{INLINETOC}}


Change Log from github repository

ToDo/Wish List

  • better code
  • move TOC into the sidebar, like {{SIDETOC}} ?
  • Option to disable the built-in TOC while keeping the Toctweak TOC enabled
    → done at 2014-04-26 release

Known Bugs and Issues

  • The inlineToc doesn't work well for RTL screens. The bullets are placed out of the TOC box. Also there is no indent shown for lower headers. <05/06/2014>
    → RTL styles added in all.css since 2014-05-07 release. Please check and comment here if it is enough for RTL languages, with those the plugin author is not familiar.



Awesome plugin! I have one problem though… It seems like the {{INLINETOC:width18}} wont work. I look at the element in the source code and the css class is not applied to the inline-toc. Have I missed some vital information or is this a nasty bug? — fnadde42fnadde42

2015-05-19 16:53

If you put {{INLINETOC:width18}} and {{INLINETOC}} in the same page (for example at page top and bottom), the css class will not apply for both inline-toc block. — s.saharas.sahara

2015-05-26 12:06

Very nice plugin !
I think there is mistake in this page in chapter 3 and 4 : the css class and max level is not in the same order between {{TOC:2-3 wide}} and {{INLINETOC:width18 3-4}}.
In my situation, when using {{INLINETOC:width18 3-4}}, the 3-4 or whatever I put in is ignored. I just installed it (22/07/2014). What am I doing wrong ?

Thanks for comment and reporting. I confirmed that ignored level values after class name parameter. I will update plugin code in sometime soon. — s.saharas.sahara

2014-07-24 10:13
New release 2014-07-24! I hope the parameter order issue now fixed. — s.saharas.sahara

2014-07-24 11:37

Feature Request

Enable users to call table of content via namespace as well. E.g.

{{TOC:2-3 ns:animals:dog#habits}}

This displays the TOC for heading 2-3 for page-section id(#habits) in page(dog) in namespace (animals) into any page that calls this syntax.

- James 26/8/2014

Enable a TOC per section on a page that can be inserted under a header rather than a TOC for the entire page.

-Justin 25/6/2016

plugin/toctweak.txt · Last modified: 2017-07-21 01:20 by s.sahara