From 7abf2806a0305e875fac09f2ea563fd07ed92386 Mon Sep 17 00:00:00 2001 From: trendschau Date: Thu, 25 Nov 2021 10:30:32 +0100 Subject: [PATCH] Version 1.5.1.1: Fix ToC-Error with headline anchors --- system/Extensions/ParsedownExtension.php | 4 +++- system/Settings.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/system/Extensions/ParsedownExtension.php b/system/Extensions/ParsedownExtension.php index f2035c5..dbfd3fd 100644 --- a/system/Extensions/ParsedownExtension.php +++ b/system/Extensions/ParsedownExtension.php @@ -363,6 +363,8 @@ class ParsedownExtension extends \ParsedownExtra $text = trim($text, ' '); + $tocText = $text; + if($this->showAnchor && $level > 1) { $text = "[#](#h-$headline){.tm-heading-anchor}" . $text; @@ -382,7 +384,7 @@ class ParsedownExtension extends \ParsedownExtra ) ); - $this->headlines[] = array('level' => $level, 'name' => $Block['element']['name'], 'attribute' => $Block['element']['attributes']['id'], 'text' => $text); + $this->headlines[] = array('level' => $level, 'name' => $Block['element']['name'], 'attribute' => $Block['element']['attributes']['id'], 'text' => $tocText); return $Block; } diff --git a/system/Settings.php b/system/Settings.php index 125ae9a..22eaa1d 100644 --- a/system/Settings.php +++ b/system/Settings.php @@ -84,7 +84,7 @@ class Settings 'editor' => 'visual', 'formats' => ['markdown', 'headline', 'ulist', 'olist', 'table', 'quote', 'notice', 'image', 'video', 'file', 'toc', 'hr', 'definition', 'code'], 'contentFolder' => 'content', - 'version' => '1.5.1', + 'version' => '1.5.1.1', 'setup' => true, 'welcome' => true, 'images' => ['live' => ['width' => 820], 'thumbs' => ['width' => 250, 'height' => 150]],