mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Make sure closing sequence is removed correctly
This commit is contained in:
@ -68,7 +68,12 @@ final class Header implements Block
|
||||
$text = \trim($text, " \t");
|
||||
|
||||
# remove closing sequence
|
||||
$text = \rtrim(\rtrim($text, '#'), " \t");
|
||||
$removedClosing = \rtrim($text, '#');
|
||||
$lastChar = \substr($removedClosing, -1, 1);
|
||||
|
||||
if (\trim($lastChar, " \t") === '') {
|
||||
$text = \rtrim($removedClosing, " \t");
|
||||
}
|
||||
|
||||
return new self($text, $level);
|
||||
}
|
||||
|
Reference in New Issue
Block a user