Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Blockquotes separated by a newline being grouped in single blockquote #27

Closed
Tooa opened this issue Jun 28, 2022 · 2 comments
Closed

Comments

@Tooa
Copy link
Contributor

Tooa commented Jun 28, 2022

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

image

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);
?>

image

@Tooa Tooa added the bug report Something isn't working label Jun 28, 2022
@secure-77 secure-77 added confirmed bug wontfix This will not be worked on labels Jul 3, 2022
@secure-77
Copy link
Owner

Hi @Tooa,

I can confirm the bug. I also recognized that there is a new beta release for parsedown, but for the moment I don`t want to switch to the beta release. The effort for testing and possible error handling is not worth it. At least not because of this "little" bug.

I will wait until there is a stable 2.0 release or if we really "need" to switch for other reasons. Iam completely with you regarding the composer, also thought about it and I want to do that for the JS dependencies as well (as soon I have some time for).

@secure-77 secure-77 removed the bug report Something isn't working label Jul 3, 2022
@secure-77
Copy link
Owner

fixed in the next release 1.5.1

@secure-77 secure-77 added implemented / fixed and removed wontfix This will not be worked on labels Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants