Skip to content

How to get level 3 headings in TOC extension? #544

Discussion options

You must be logged in to vote

More or less it works, but tocLevel cannot currently exceed 3, because h4..h6 are not given an id (I do not know why...).

<?php
// modified TOC extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/toc

class YellowToc {
    const VERSION = "0.8.5";
    public $yellow;         // access to API
    
    // Handle initialisation
    public function onLoad($yellow) {
        $this->yellow = $yellow;
        $this->yellow->system->setDefault("tocLevel", "3"); // shows headings up to nth level
        $this->yellow->system->setDefault("tocNumbering", "1"); // if 0 numbers are not added before headings
    }

    // Handle page content in HTML format
    public function o…

Replies: 14 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by annaesvensson
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #544 on December 27, 2020 00:52.