DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:toctweak

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:toctweak [2015-09-01 06:50] s.saharaplugin:toctweak [2023-12-04 21:10] (current) – [Control macro for DokuWiki built-in TOC] Fix typo 177.208.41.57
Line 1: Line 1:
-====== TOC Tweaking Assortment Plugin ======+====== TocTweak Plugin ======
  
 ---- plugin ---- ---- plugin ----
-description: 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.+description: Show tailored table of contents (TOC) of specified page/section in the page content
 author     : S.Sahara author     : S.Sahara
 email      : sahara.satoshi@gmail.com email      : sahara.satoshi@gmail.com
 type       : syntax, action type       : syntax, action
-lastupdate : 2015-09-01 +lastupdate : 2018-01-08 
-compatible : Binky, Ponder Stibbons, Hrun, Detritus+compatible : Hrun, Detritus, Elenor of Tsort, Frusterick Manners, Greebo, Hogfather, Igor
 depends    :  depends    : 
 conflicts  : toc, inlinetoc, tocafterheadline conflicts  : toc, inlinetoc, tocafterheadline
Line 13: Line 13:
 tags       : toc tags       : toc
  
-downloadurl: https://github.com/ssahara/dw-plugin-toctweak/archive/master.zip+downloadurl: https://github.com/ssahara/dw-plugin-toctweak/archive/2018-01-08.zip
 bugtracker : https://github.com/ssahara/dw-plugin-toctweak/issues bugtracker : https://github.com/ssahara/dw-plugin-toctweak/issues
 sourcerepo : https://github.com/ssahara/dw-plugin-toctweak sourcerepo : https://github.com/ssahara/dw-plugin-toctweak
Line 23: Line 23:
 ===== Installation ===== ===== Installation =====
  
-Install the plugin through the [[plugin:extension|Extension Manager]] or [[plugin:plugin|Plugin Manager]] using the download URL above, which points to latest version of the plugin. Refer to [[:plugin_installation_instructions|plugin installation instructions]].+Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
-===== Examples/Usage =====+Current development work in progress under Version 2.x series.    
 +In case you want to get older plugin version, please visit: 
 +  * [[https://github.com/ssahara/dw-plugin-toctweak/releases/tag/2017-12-09| Version 1.1 (2017-12-09)]] 
 + 
 +===== 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 ==== 
 + 
 +<code> 
 +~~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 
 +</code> 
 + 
 +== Note == 
 +  * Headlines level parameter must be "//n-m//", "//n//" or "//-m"// format. 
 +  * The built-in toc box (or %%auto-TOC%%) should be one per page, therefore more than once "''%%~~TOC_HERE~~%%''" will be ignored. 
 + 
 +==== METATOC: Another method to show TOC (in different looks/design)==== 
 + 
 +{{ https://github.com/ssahara/dw-plugin-toctweak/raw/master/example/image2.png?200&recache|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. 
 + 
 +  - ''%%{{METATOC}}%%'' : Headline list with hierarchical numbers 
 +  - ''%%{{TOC}}%%'': similar looks of DW built-in %%TOC%% box without open/close feasure. 
 +  - ''%%{{INLINETOC}}%%'' : Headline list in rounded box 
 +  - ''%%{{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 == 
 +  * The section title may contains spaces, therefore headline level parameter must be given before "%%>%%"
 +  * set %%TOC%% title blank (given after "%%|%%") to remove default title -- "Table of Contents"
 +  * SIDETOC ignores //n-m// parameter, which will be retrieved from metadata of current page. 
 + 
 +---- 
 + 
 +===== Examples/Usage v1=====
  
 ==== 1. Set the TOC initially closed ==== ==== 1. Set the TOC initially closed ====
 +
   ~~CLOSETOC~~   ~~CLOSETOC~~
  
Line 33: Line 84:
  
 ==== 2. Set top and max level of headings displayed in the TOC==== ==== 2. Set top and max level of headings displayed in the TOC====
-  ~~TOC:2-4 ~~+ 
 +  ~~TOC 2-4 ~~
  
   * Control the content of the TOC for the page. There are two numeric parameters: [[:config:toptoclevel]] and [[:config:maxtoclevel]] repectively.   * Control the content of the TOC for the page. There are two numeric parameters: [[:config:toptoclevel]] and [[:config: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.   * 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:<code>   * You can tweak either top or max level of headings, for example:<code>
-~~TOC:2~~ +~~TOC 2~~ 
-~~TOC:-3~~+~~TOC -3~~
 </code> </code>
  
 ==== 3. move TOC position ==== ==== 3. move TOC position ====
 +
   {{TOC}}   {{TOC}}
  
   * 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.    * 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. 
  
-  {{TOC:wide}}+  {{TOC wide}}
  
   * 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.   * 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}}+  {{TOC 2-3 wide}}
  
   * You may give both class and heading levels parameter in this syntax.    * You may give both class and heading levels parameter in this syntax. 
Line 57: Line 110:
 ==== 4. inline TOC ==== ==== 4. inline TOC ====
  
-  {{INLINETOC:width18 3-4}} +  {{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.   * This syntax renders TOC of a page inside the page content. "width18" class is defined in all.css of this plugin.
  
 +----
  
 ===== Configuration and Settings ===== ===== Configuration and Settings =====
  
-The plugin can be configured with the configuration manager in the admin menu.  +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}}%%''.|+
  
 +^''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 [[:config:toptoclevel]], [[:config:maxtoclevel]] and [[:config:tocminheads]]. Especially when **tocAllHeads** is on, global toptoclevel and maxtoclevel values are set to 1 and 5 respectively.
  
 +----
  
 ===== Development ===== ===== Development =====
  
-=== Change Log from github repository ===+==== Backward incompatible changes ====
  
-{{rss>https://github.com/ssahara/dw-plugin-toctweak/commits/master.atom date 5}}+**ver.2 (2018-01-08)** 
 +  - 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. 
 +  - 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.
  
-=== ToDo/Wish List === +==== Change Log from github repository ====
-  * 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+
  
 +{{rss>https://github.com/ssahara/dw-plugin-toctweak/commits/master.atom date}}
  
-===== Known Bugs and Issues =====+==== Bug reports and feature requests ====
  
-  * 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.+Please refer to the issue tracker (link button found at near page top) for reporting issues.
  
- +----
-===== FAQ =====+
  
 ===== Discussion ===== ===== Discussion =====
 +Here are **obsoleted** topics of TocTweak plugin Version 1.x
 +
 +----
 +
 Awesome plugin! 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?  --- [[user>fnadde42|fnadde42]] //2015-05-19 16:53// 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?  --- [[user>fnadde42|fnadde42]] //2015-05-19 16:53//
Line 107: Line 170:
 > Thanks for comment and reporting. I confirmed that ignored level values after class name parameter. I will update plugin code in sometime soon.  --- [[user>s.sahara|s.sahara]] //2014-07-24 10:13//  > Thanks for comment and reporting. I confirmed that ignored level values after class name parameter. I will update plugin code in sometime soon.  --- [[user>s.sahara|s.sahara]] //2014-07-24 10:13// 
 > New release 2014-07-24! I hope the parameter order issue now fixed.  --- [[user>s.sahara|s.sahara]] //2014-07-24 11:37//  > New release 2014-07-24! I hope the parameter order issue now fixed.  --- [[user>s.sahara|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 ==== ==== Feature Request ====
-Enable users to call table of content via namespace as well. \\ +Enable users to call table of content via namespace as well. E.g. 
-e.g. \\ + 
-<html> +  {{TOC:2-3 ns:animals:dog#habits}}
-{{TOC:2-3 ns:animals:dog#habits}} +
-</html>+
  
 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.  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 - 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.1441083032.txt.gz · Last modified: 2015-09-01 06:50 by s.sahara

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki