mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Create ID's for Header elements so they can be referenced in anchor tags
Closes #710
This commit is contained in:
parent
1610e4747c
commit
7ead769742
@ -553,15 +553,19 @@ class Parsedown
|
|||||||
}
|
}
|
||||||
|
|
||||||
$text = trim($text, ' ');
|
$text = trim($text, ' ');
|
||||||
|
$link = strtolower(str_replace(' ','-',$text));
|
||||||
|
|
||||||
$Block = array(
|
$Block = array(
|
||||||
'element' => array(
|
'element' => array(
|
||||||
'name' => 'h' . $level,
|
'name' => 'h' . $level,
|
||||||
|
'attributes' => array(
|
||||||
|
'id' => $link,
|
||||||
|
),
|
||||||
'handler' => array(
|
'handler' => array(
|
||||||
'function' => 'lineElements',
|
'function' => 'lineElements',
|
||||||
'argument' => $text,
|
'argument' => $text,
|
||||||
'destination' => 'elements',
|
'destination' => 'elements',
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1992,3 +1996,4 @@ class Parsedown
|
|||||||
'wbr', 'time',
|
'wbr', 'time',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user