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

Allow inlines to backtrack into characters that were suspected as

inlines but ruled out
This is required for backslash escaped Hard breaks to work:
Parsedown first checks to see if these are escape sequences,
however when they are ruled out they should not be assumed to be
plaintext since a later inline (Hardbreak) may backtrack into these
unconsumed characters.
This commit is contained in:
Aidan Woods 2019-01-25 19:02:30 +00:00
parent 1fd2e14b72
commit 5a50930cb0
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9

View File

@ -306,16 +306,8 @@ final class Parsedown
continue 2; continue 2;
} }
if (! isset($startPosition)) {
$startPosition = $Excerpt->offset();
}
# the marker does not belong to an inline
$Inlines[] = Plaintext::build($Excerpt->choppingUpToOffset($startPosition + 1));
/** @psalm-suppress LoopInvalidation */ /** @psalm-suppress LoopInvalidation */
$Excerpt = $Excerpt->choppingFromOffset($startPosition + 1); $Excerpt = $Excerpt->addingToOffset(1);
} }
$Inlines[] = Plaintext::build($Excerpt->choppingFromOffset(0)); $Inlines[] = Plaintext::build($Excerpt->choppingFromOffset(0));