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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user