GithubHelp home page GithubHelp logo

cot-autotoc-2's Introduction

AutoTOC

Based on original AutoTOC plugin by Gert Hengeveld

This Cotonti plugin automatically generates a Table Of Contents for any page. HTML heading tags are extracted and listed in a tree. The page body is modified to include anchors in source HTML.

Features of new AutoTOC

  • Fixed bug with output empty TOC on some pages
  • Fixed ghengeveld/AutoTOC#1 (wrong numbering on same titles)
  • Now used canonical URL for TOC
  • Customizing and overriding TOC display style via resource strings
  • Added configurable class and prefix for TOC item
  • Allow TOC elements with attributes
  • Allow unlimited nesting

Installation

Simply upload the plugin folder to your /plugins directory and enable the plugin in your Administration panel.

Configuration

The plugin has some configurable setting. You can configure the HTML tags that should be included in the TOC. Default value is h2,h3. Also you can change class and prefix for TOC item.

Resource strings

As default plugin uses these strings:

$R['autotoc_anchor'] = '<a class="{$class}" name="{$prefix}{$number}" id="{$prefix}{$number}"></a><{$elem}{$attr}>{$number}. {$title}</{$elem}>';
$R['autotoc_item'] = '<li><a href="{$url}" title="{$title_safe}">{$number}. {$title}</a>{$sublist}</li>';
$R['autotoc_list'] = '<ol style="list-style:none;" class="page_toc">{$toc_list}</ol>';

It can be re-assigned by yourself to suit your needs. You can use these variables in resource strings:

  • heading — full heading string (with all HTML markup)
  • title — full title (with inner markup if exists)
  • title_safe — title with stripped inner tags
  • class — anchor class (configured in admin panel)
  • prefix — anchor prefix (configured in admin panel)
  • url — fullpath url with anchor for current heading
  • elem — HTML tag represents current heading
  • number — heading count number on current level

cot-autotoc-2's People

Contributors

macik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.