Eleventy Plugin Toc screenshot

Eleventy Plugin Toc

Author Avatar Theme by Jdsteinbach
Updated: 29 Sep 2021
68 Stars

11ty plugin to generate a TOC from page content

Overview

The Eleventy plugin for generating a Table of Contents (TOC) is an impressive tool that streamlines the navigation of content-heavy pages. Designed specifically for Eleventy, this plugin makes it easy to create a dynamic TOC from the headings in your documents. With its user-friendly setup and flexibility in customization, this plugin has become a staple for developers looking to enhance user experience on their sites.

Integrating the TOC plugin requires minimal effort. By ensuring your headings are properly formatted with anchor IDs, you can generate a neatly organized TOC that allows readers to jump to specific sections seamlessly. Whether you’re working with Markdown or HTML, this plugin accommodates your setup with its simple configuration options.

Features

  • Customizable Heading Tags: Specify which heading tags (e.g., h2, h3, h4) you want included in the TOC to tailor the content to your needs.

  • Flexible Wrapper Options: Define the wrapper element for the TOC, making it easy to integrate into your site’s design without unnecessary markup.

  • Class Assignment: Apply a specific class to the TOC wrapper for better styling control and consistency across your project.

  • ARIA Support: Optionally set an aria-label on the wrapper for improved accessibility, making your content more friendly for assistive technologies.

  • List Type Toggle: Choose between unordered (ul) or ordered (ol) lists for the TOC, enhancing visual clarity according to your design preferences.

  • Flat List Format: Opt for a flat TOC instead of nested lists if preferred, simplifying the layout for straightforward navigation.

  • Default Option Overrides: Easily customize options on-the-fly by passing JSON objects, allowing selective tweaking without losing the default settings.

  • Future Enhancements: The roadmap hints at future improvements, like enhanced testing to ensure reliability and increased functionality.