DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:inlinetoc

This is an old revision of the document!


inlinetoc Plugin

Compatible with DokuWiki

2010-11-07, 2011-05-25, Angua, Adora Belle, Weatherwax

plugin Renders the toc of a page inside the page content, a la Mediawiki

Last updated on
2013-07-27
Provides
Syntax, Action
Repository
Source
Conflicts with
intoc, toctweak

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to intoc, toc, tocselect, toctweak

Tagged with mediawiki, toc

Installation

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

Examples/Usage

{{INLINETOC}}

Sample result:

Click to view full size

Notes

The div created has the class set to inlinetoc2. The 2 is here to not enter in conflict with the TOC plugin which already use the class inlinetoc.

The plugin won't work if you specify {{NOTOC}} on the page because it relies on Dokuwiki's internal toc processor to build the page's toc.

Change Log

  • 2013-07-27
  • 2011-09-03
    • replaced inline javascript with addInitEvent call
  • 2011-08-12
    • Dokuwiki's toc is hidden on page where inlinetoc is used
    • Fixed print issue
  • 2011-07-16
    • Added CSS to hide DokuWiki's TOC.
      Note that this will hide DokuWiki's TOC on every pages, not just pages with an inlinetoc.
      If you want to enable it, edit the plugins/inlinetoc/style.css file and uncomment (remove the underscore) at the beginning of div.toc.
  • 2011-05-30
    • Initial release

Wishes

  1. Can this plugin be enabled for whole wiki?
    Not really because it's built as a replacement plugin, not a general purpose plugin. It could be adapted but I believe it would make more sense to make a completely separate plugin for that purpose. Andreone 30/12/2011

  2. Could it be possible to limit the displayed level of headings?
    e.g. {{INLINETOC 3}} will only display level1…level3 in the TOC Joachim 11.01.2012
    As the plugin directly use Dokuwiki's TOC, I don't think I can do that. I will think about this however. Andreone 13/01/2012

Discussion

How to I disable the built-in TOC without also disabling inlinetoc?

I tried but couldn't find a way when I implemented inlinetoc. This reason is because it uses the toc definition generated by Dokuwiki. But, to disable the built-in TOC, you have to put {{NOTOC}} on your page, which causes Dokuwiki to not generate the toc definition.
To achieve what you want, that would means to parse the raw page to built the toc, something I wanted to avoid. This may come in a V2 if it appears to be a popular demand.
I added a note about this issue on this page. Andreone, 2011/06/23
Maybe the plugin author could hide the built-in TOC via CSS? I see it is wrapped in <div class="toc">...</div>. Just a thought. — Rik Blok 2011/06/30 06:35
I know the Dokuwiki's toc can be hidden with a little CSS, but in this case it's always hidden, including on pages that don't have an inlinetoc. What I want to do, is only hide Dokuwiki's toc on pages that have the inlinetoc tag.
I tried hooking TPL_METAHEADER_OUTPUT to inject a stylesheet but again it would always hide Dokuwiki's toc.
I've committed a version with a commented CSS to hide Dokuwiki's toc for those aren't interested with Dokuwiki's toc (remove the _ before div.toc in plugins/inlinetoc/style.css to enable the style).
Andreone, 2011/07/16
I finally managed to disabled dokuwiki's toc only on pages where inlinetoc is used with a bit of javascript.
Andreone, 2011/08/12

Very nice! You should refresh Last update on plugin page. Thore, 2011/08/16
Totally forgot, thanks.

Hiding Dokuwiki TOC for Adora Belle

Until the plugin is updated, here is what you'll have to change in order to hide the Dokuwiki TOC. Edit inlinetoc.js:

if(elements[i].className == 'toc') {

to

if(elements[i].id == 'dw__toc') {

Also see issue on Github.

inlinetoc.js jQuery version for Adora Belle and Weatherwax (solved)

Here is a jQuery solution to make DokuWiki TOC invisible.

inlinetoc.js
function hideDokuwikiToc() {
    var $toc = jQuery('#dw__toc');
    var $toc2= jQuery('div.inlinetoc2');
    if($toc2.length && $toc.length) {
        $toc.css('display', 'none');
    }
}
jQuery(function(){
    hideDokuwikiToc();
});

s.sahara 2013/05/13

Thanks s.sahara, I've created a fork with your code for Weatherwax. Here's the GitHub zip for download. — Rik Blok 2013/07/20 08:11 This plugin has been updated to work with Weatherwax so my fork isn't needed anymore. — Rik Blok 2013/07/27 21:00

Thank you both of you for providing a working solution during my coma. – Andreone 2013/07/27 22:30

Problem: no output on screen, INLINETOC not working? (solved)

I inserted

{{INLINETOC}}

at the beginning of a page, but no toc is generated.
Any idea would goes wrong? 24.08.2011 Joachim

At first, do you correctly installed the plugin? When downloaded from github, the directory inside the archive must be renamed to inlinetoc.
Do you still see the standard TOC or absolutely nothing?
Your test page must have at least three header lines so dokuwiki generates toc entries (that inlinetoc use). Andreone, 2011/08/24
- plugin directory is correct
- standard TOC is visible
- more than three header lines

After some investigation it seems to be a conflict with sortablejs plugin and/or plugin searchtablejs
If I disable these plugins, INLINETOC works well.
On other pages with no sortablejs/searchtablejs INLINETOC also works well.2011-08-25 Joachim

Examples:

not working

====== plugin inlinetoc ======

{{INLINETOC}}

===== - Header 1 =====

==== - Header 1.2 ====

==== - Header 1.2 ====

===== - Header 2 =====

<sortable>
<searchtable>
^ Header ^
| Test 1 |
| Test 2 |
</searchtable>
</sortable>

working

====== plugin inlinetoc ======

{{INLINETOC}}

===== - Header 1 =====

==== - Header 1.2 ====

==== - Header 1.2 ====

===== - Header 2 =====

<searchtable>
<sortable>
^ Header ^
| Test 1 |
| Test 2 |
</sortable>
</searchtable>
Thanks for the update. I'll try to see if I can do something about that conflict. Andreone, 2011/08/25
INLINETOC functionality with <searchtable> and <sortable> on the same page depends on the order of <searchtable> and <sortable>
Solved: Use the following order and INLINETOC will work: 1. <searchtable> and 2. <sortable>
see example above! 2011-08-30 Joachim

Disabling numbering (solved)

I use the numberedheadings plugin to number the headings of the pages.

In print output, INLINETOC also numbers the headings (first number):

1. Header 1
   1. 1 Header 2
      1. 1.1 Header 3
      2. 1.2 Header 3
   2. 2 Header 2
etc.

On screen, a bullet point is shown.

Is it possible to disable this (per page)?2011-09-14 Joachim

Solved: I added the following to conf/userprint.css: 2011-09-15 Joachim
div.inlinetoc2 ul {
    list-style-type: square;
    line-height: 1.5em;
    _margin-left: 2em;
}
plugin/inlinetoc.1375097713.txt.gz · Last modified: 2013-07-29 13:35 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