From ef100b2dcd988bb913542c37ed3a8c4588ba327e Mon Sep 17 00:00:00 2001 From: spleenftw Date: Thu, 4 Jun 2026 12:12:43 +0200 Subject: [PATCH] Add maxLevel setting to plugin configuration; enhance TOC heading depth selection --- plugin.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/plugin.php b/plugin.php index fcb514a..8452a31 100644 --- a/plugin.php +++ b/plugin.php @@ -7,6 +7,7 @@ class PluginBluditToc extends Plugin { $this->dbFields = array( 'title' => 'On this page', 'navbarHeight' => 80, + 'maxLevel' => 4, ); } @@ -15,6 +16,7 @@ class PluginBluditToc extends Plugin { $title = htmlspecialchars($this->getValue('title'), ENT_QUOTES, 'UTF-8'); $navbarHeight = (int) $this->getValue('navbarHeight'); + $maxLevel = (int) $this->getValue('maxLevel'); $h = ''; @@ -23,6 +25,16 @@ class PluginBluditToc extends Plugin { $h .= ''; $h .= ''; + $h .= '
'; + $h .= ''; + $h .= ''; + $h .= '' . $L->get('Deepest heading level included in the table of contents.') . ''; + $h .= '
'; + $h .= '
'; $h .= ''; $h .= ''; @@ -76,17 +88,20 @@ class PluginBluditToc extends Plugin { public function siteBodyEnd() { $title = json_encode($this->getValue('title')); $navbarHeight = (int) $this->getValue('navbarHeight'); + $maxLevel = (int) $this->getValue('maxLevel'); return '