Skip to content

Commit

Permalink
Create ID's for Header elements so they can be referenced in anchor tags
Browse files Browse the repository at this point in the history
Closes erusev#710
  • Loading branch information
netniV committed Apr 29, 2020
1 parent 1610e47 commit 7ead769
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Parsedown.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,15 +553,19 @@ protected function blockHeader($Line)
}

$text = trim($text, ' ');
$link = strtolower(str_replace(' ','-',$text));

$Block = array(
'element' => array(
'name' => 'h' . $level,
'attributes' => array(
'id' => $link,
),
'handler' => array(
'function' => 'lineElements',
'argument' => $text,
'destination' => 'elements',
)
),
),
);

Expand Down Expand Up @@ -1992,3 +1996,4 @@ static function instance($name = 'default')
'wbr', 'time',
);
}

0 comments on commit 7ead769

Please sign in to comment.