mirror of
https://github.com/typemill/typemill.git
synced 2025-08-05 21:57:31 +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;
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user