1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

Assert marker is correct for hard and soft breaks

This commit is contained in:
Aidan Woods 2019-02-10 18:51:23 +00:00
parent 369aea5d8d
commit 3bb24c20a6
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9
2 changed files with 12 additions and 0 deletions

View File

@ -33,6 +33,12 @@ final class HardBreak implements Inline
*/ */
public static function build(Excerpt $Excerpt, State $State) public static function build(Excerpt $Excerpt, State $State)
{ {
$marker = \substr($Excerpt->text(), 0, 1);
if ($marker !== "\n") {
return null;
}
$context = $Excerpt->context(); $context = $Excerpt->context();
$offset = $Excerpt->offset(); $offset = $Excerpt->offset();

View File

@ -36,6 +36,12 @@ final class SoftBreak implements Inline
*/ */
public static function build(Excerpt $Excerpt, State $State) public static function build(Excerpt $Excerpt, State $State)
{ {
$marker = \substr($Excerpt->text(), 0, 1);
if ($marker !== "\n") {
return null;
}
$context = $Excerpt->context(); $context = $Excerpt->context();
$offset = $Excerpt->offset(); $offset = $Excerpt->offset();