Description
Describe the bug
Parsedown does not identify different blockquotes when the blockquotes are just separated by a newline. The following markdown file:
> This is a blockquote
> This is another blockquote
results in the following HTML
<blockquote>
<p>This is a blockquote</p>
<p>This is another blockquote</p>
<blockquote>
Note that this is an upstream issue.
To Reproduce
Steps to reproduce the behavior:
- Go to the Parsedown Demo
- Enter the markdown file listed in the issue description
Expected behavior
<blockquote>
<p>This is a blockquote</p>
</blockquote>
<blockquote>
<p>This is another blockquote</p>
</blockquote>
Workaround
- Add a newline and regular text between the elements
Screenshots
Desktop (please complete the following information):
- OS: Ubuntu 22.04
- Browser Firefox 102
Solution proposal
I tested the newest Parsedown beta v2.0.0-beta-1 and it looks like the problem is fixed in this version.
We may consider switching to this beta release and test how stable it works with our existing test documents. When upgrading to the latest version, I suggest to use Php Composer as well for managing the dependency.
Here is a step by step guide, how I tested the behavior with the beta release:
Setup
$ sudo apt install php8.1
$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
$ php composer-setup.php
$ php -r "unlink('composer-setup.php');"
# Dependencies
$ sudo apt-get install php8.1-mbstring
$ php ../composer.phar require erusev/parsedown:v2.0.0-beta-1
$ php demo.php
demo.php
<?php
require __DIR__ . '/vendor/autoload.php';
use Erusev\Parsedown\Configurables\Breaks;
use Erusev\Parsedown\Configurables\SafeMode;
use Erusev\Parsedown\Configurables\StrictMode;
use Erusev\Parsedown\State;
use Erusev\Parsedown\Parsedown;
$markdown = <<<EOD
> This is a blockquote
> this is another blockquote
EOD;
$state = new State([
new Breaks(true),
new SafeMode(true),
new StrictMode(false)
]);
$Parsedown = new Parsedown($state);
echo $Parsedown->toHtml($markdown);
?>