1
0
mirror of https://github.com/typemill/typemill.git synced 2025-08-06 22:26:32 +02:00

Version 1.5.1: Fix Headline Anchor and change anchor css

This commit is contained in:
trendschau
2021-11-18 21:58:16 +01:00
parent 1a09c7767b
commit 6e1e2d1e34
2 changed files with 9 additions and 22 deletions

View File

@@ -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;