From 3bb24c20a6d06bf1e837a882e533f8e422de0350 Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Sun, 10 Feb 2019 18:51:23 +0000 Subject: [PATCH] Assert marker is correct for hard and soft breaks --- src/Components/Inlines/HardBreak.php | 6 ++++++ src/Components/Inlines/SoftBreak.php | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/Components/Inlines/HardBreak.php b/src/Components/Inlines/HardBreak.php index f2bb819..ddfaa9e 100644 --- a/src/Components/Inlines/HardBreak.php +++ b/src/Components/Inlines/HardBreak.php @@ -33,6 +33,12 @@ final class HardBreak implements Inline */ public static function build(Excerpt $Excerpt, State $State) { + $marker = \substr($Excerpt->text(), 0, 1); + + if ($marker !== "\n") { + return null; + } + $context = $Excerpt->context(); $offset = $Excerpt->offset(); diff --git a/src/Components/Inlines/SoftBreak.php b/src/Components/Inlines/SoftBreak.php index 1def586..11d36f2 100644 --- a/src/Components/Inlines/SoftBreak.php +++ b/src/Components/Inlines/SoftBreak.php @@ -36,6 +36,12 @@ final class SoftBreak implements Inline */ public static function build(Excerpt $Excerpt, State $State) { + $marker = \substr($Excerpt->text(), 0, 1); + + if ($marker !== "\n") { + return null; + } + $context = $Excerpt->context(); $offset = $Excerpt->offset();