Open main menu

Extension:TocTree

InstallationEdit

  • Download and place the file(s) in a directory called TocTree in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'TocTree' );
    
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.24 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension() If you need to install this extension on these earlier versions (MediaWiki 1.24 and earlier), instead of wfLoadExtension( 'TocTree' );, you need to use:

require_once "$IP/extensions/TocTree/TocTree.php";

CustomizationEdit

The PHP script will add two new options to the user preferences. They were added to the Misc section:

  • Floated table of contents
  • Expand table of contents

Defaults are collapsed but not floated tocs. You can overwrite the default values by setting true in your LocalSettings.php file:

$wgDefaultUserOptions['toc-floated'] = false;
$wgDefaultUserOptions['toc-expand'] = false;

Prevention of TOC floatingEdit

The author has the opportunity to prevent floating of the TOC set by the user(s) by using a div tag with the style class noFloat enclosing the TOC.

<div class="noFloat">__TOC__</div>

Known problemsEdit

There are the well-known problems of floated boxes like:

  • Missing list bullets, see for instance Missing Bullet Points
  • Design problems of narrow TOCs and positioning problems with text and wide right-floated boxes.

Additional:

  • Bidi support (right-to-left writing direction) implemented but not yet tested (for instance needed for Hebrew and Arabic).
  • Support of only the MonoBook and Vector skins.

FeedbackEdit

See TocTree tasks on Phabricator.