目次

TocTweak Plugin

互換性のある DokuWiki バージョン

  • 2024-02-06 "Kaos" 不明
  • 2023-04-04 "Jack Jackrum" 不明
  • 2022-07-31 "Igor" 確認済
  • 2020-07-29 "Hogfather" 確認済

plugin Show tailored table of contents (TOC) of specified page/section in the page content

最終更新日
2018-01-08
種類
Syntax, Action
リポジトリ
ソース
競合
inlinetoc, intoc, toc, tocafterheadline

Installation

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

Current development work in progress under Version 2.x series. In case you want to get older plugin version, please visit:

Feature

Implement different mechanism for table of contents (TOC). TocTweak plugin (version 2) will store all headlines in the page to metadata (even if some of them are not shown in toc box), and provide METATOC syntax variants that render tailored TOC block inside the page content using metadata.

Examples/Usage v2

Control macro for DokuWiki built-in TOC

~~CLOSETOC~~         Let the TOC box initially closed
~~TOC 2-3~~          Headlines within level 2 to 3 will appear in the TOC box
~~NOTOC 2-3~~        No TOC box on the page, but set headline level parameter
~~TOC 2-3 wide~~     Widen the TOC box by assigning "wide" css class
~~TOC_HERE 2-3~~     Locate the TOC box where the macro is placed in the page
Note

METATOC: Another method to show TOC (in different looks/design)

METATOC variants

TocTweak plugin provides following syntax to render toc block in pages where it is located in source. These are implemented as variants of basic METATOC syntax, and can be used multiple times in a page.

  1. {{METATOC}} : Headline list with hierarchical numbers
  2. {{TOC}}: similar looks of DW built-in TOC box without open/close feasure.
  3. {{INLINETOC}} : Headline list in rounded box
  4. {{SIDETOC}} : dedicated to use in sidebar page

METATOC syntax family can render headline list of other page. It is also possible to specify starting section title, headline level range, and TOC box title.

{{METATOC 3-3 >:wiki:syntax#Text Conversions | Text Conversions}}
{{METATOC 3-3 >:wiki:syntax#Text Conversions |}}
{{METATOC 2-3 >#section title}}
{{METATOC 2-3}}
Note

Examples/Usage v1

1. Set the TOC initially closed

~~CLOSETOC~~

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

~~TOC 2-4 ~~

3. move TOC position

{{TOC}}
{{TOC wide}}
{{TOC 2-3 wide}}

4. inline TOC

{{INLINETOC width18 3-4}} 

Configuration and Settings

The plugin can be configured with the Configuration Manager in the admin menu.

tocAllHeads Store all headlines to page metadata
tocPosition Change always auto-TOC position for normal pages
0: default (top-right)
1: after the First Level 1 headline
2: after the First Level 2 headline
6: after the First headline
9: disable auto-TOC.
toptoclevel Upper level of headline which can appear in table of contents
maxtoclevel Lower level of headline which can appear in table of contents
tocminheads Minimum amount of headlines that determins whether the TOC is built

TocTweak plugin supersedes global config settings toptoclevel, maxtoclevel and tocminheads. Especially when tocAllHeads is on, global toptoclevel and maxtoclevel values are set to 1 and 5 respectively.


Development

Backward incompatible changes

ver.2 (2018-01-08)

  1. Previously in version 1.x, {{TOC}} syntax was available to move DokuWiki Auto-TOC box from top right corner to other place inside the page. Since version 2.x, it has changed to render METATOC instead of Auto-TOC. Alternative ~~TOC_HERE~~ macro is available.
  2. DokuWiki Auto-TOC must exist only one per page whenever it should be shown. Use of ~~TOC_HERE~~ macro is restricted to once in a page.

Change Log from github repository

Bug reports and feature requests

Please refer to the issue tracker (link button found at near page top) for reporting issues.


Discussion

Here are obsoleted topics of TocTweak plugin Version 1.x


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? — fnadde42 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.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.sahara 2014-07-24 10:13
New release 2014-07-24! I hope the parameter order issue now fixed. — s.sahara 2014-07-24 11:37

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.


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