Extension:TocTree

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
TocTree

Release status:Extension status beta

TocTree's extension settings.png
ImplementationTemplate:Extension#type User interface
MediaWikiTemplate:Extension#mediawiki 1.20
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
Hooks usedTemplate:Extension#hook
BeforePageDisplayManual:Hooks/BeforePageDisplay
GetPreferencesManual:Hooks/GetPreferences

Translate the TocTree extension if it is available at translatewiki.net

Check usage and version matrix.

IssuesPhabricator

Open tasks · Report a bug

Installation[edit]

  • 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' );
    
  • YesY 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";

Customization[edit]

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 floating[edit]

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 problems[edit]

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.

Feedback[edit]

See TocTree tasks on Phabricator.