From 6e1e2d1e3427e497c1ffca8b6d6ec24bff5e0fd8 Mon Sep 17 00:00:00 2001 From: trendschau Date: Thu, 18 Nov 2021 21:58:16 +0100 Subject: [PATCH] Version 1.5.1: Fix Headline Anchor and change anchor css --- system/Extensions/ParsedownExtension.php | 25 +++++++----------------- themes/cyanine/css/style.css | 6 ++---- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/system/Extensions/ParsedownExtension.php b/system/Extensions/ParsedownExtension.php index 5886452..7d954d1 100644 --- a/system/Extensions/ParsedownExtension.php +++ b/system/Extensions/ParsedownExtension.php @@ -77,10 +77,11 @@ class ParsedownExtension extends \ParsedownExtra } public function markup($Elements) - { + { # convert to markup $markup = $this->elements($Elements); + # die(); # trim line breaks $markup = trim($markup, "\n"); @@ -362,6 +363,11 @@ class ParsedownExtension extends \ParsedownExtra $text = trim($text, ' '); + if($this->showAnchor && $level > 1) + { + $text = "[#](#h-$headline){.tm-heading-anchor}" . $text; + } + $Block = array( 'element' => array( 'name' => 'h' . min(6, $level), @@ -376,23 +382,6 @@ class ParsedownExtension extends \ParsedownExtra ) ); - if($this->showAnchor && $level > 1) - { - $Block['element']['elements'] = array( - array( - 'name' => 'a', - 'attributes' => array( - 'href' => "#h-" . $headline, - 'class' => 'tm-heading-anchor', - ), - 'text' => '#', - ), - array( - 'text' => $text, - ) - ); - } - $this->headlines[] = array('level' => $level, 'name' => $Block['element']['name'], 'attribute' => $Block['element']['attributes']['id'], 'text' => $text); return $Block; diff --git a/themes/cyanine/css/style.css b/themes/cyanine/css/style.css index 3c4e5ce..6f0a093 100644 --- a/themes/cyanine/css/style.css +++ b/themes/cyanine/css/style.css @@ -69,7 +69,6 @@ article h1, article h2, article h3, article h4, article h5, article h6{ line-height: 1.15em; font-weight: 700; line-height: 1em; - position: relative; } h1,h2,h3,h4,h5,h6{ word-wrap: break-word; hyphens: auto; } article h1{ font-size: 2.2em; margin: 1.4em 0 0.6em; z-index:1; } @@ -237,9 +236,8 @@ ul.TOC,.TOC ul{ /* Style the optional anchor-links for headlines */ a.tm-heading-anchor { - position: absolute; - top: 0; - left: -0.8em; + display: inline-block; + margin-left: -0.8em; width: 0.8em; font-weight: 300; opacity: 0;