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 are merged into one single blockquote #716

Open
paulRbr opened this issue Oct 2, 2021 · 1 comment
Open

Multiple blockquotes are merged into one single blockquote #716

paulRbr opened this issue Oct 2, 2021 · 1 comment

Comments

@paulRbr
Copy link

paulRbr commented Oct 2, 2021

It seems the markdown parser does not detect empty lines in between two different blockquotes.
Indeed if you want to render two different blockquotes, one after another, redcarpet currently merges both quotes into a single one.

Failing example

irb(main):002:0> markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true
)                                                   
=> #<Redcarpet::Markdown:0x000055a02b0bdf80 @renderer=#<Redcarpet::Render::HTML:0x000055a02b0be020 @...

irb(main):004:0> text = <<~TXT                       
This is a paragraph
                                  
> This is a multiline
>                                                                                       
> blockquote 
                                
> This is a second blockquote
TXT                                
=> "This is a paragraph\n\n> This is a multiline\n> \n> blockquote\n\n> This is a second blockquote\n"

irb(main):013:0> markdown.render(text)               
=> "<p>This is a paragraph</p>\n\n<blockquote>\n<p>This is a multiline</p>\n\n<p>blockquote</p>\n\n<p>This is a second blockquote</p>\n</blockquote>\n"

What is expected

irb(main):002:0> markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true
)                                                   
=> #<Redcarpet::Markdown:0x000055a02b0bdf80 @renderer=#<Redcarpet::Render::HTML:0x000055a02b0be020 @...

irb(main):004:0> text = <<~TXT                       
This is a paragraph
                                  
> This is a multiline
>                                                                                       
> blockquote 
                                
> This is a second blockquote
TXT                                
=> "This is a paragraph\n\n> This is a multiline\n> \n> blockquote\n\n> This is a second blockquote\n"

irb(main):013:0> markdown.render(text)               
=> "<p>This is a paragraph</p>\n\n<blockquote>\n<p>This is a multiline</p>\n\n<p>blockquote</p></blockquote>\n\n<blockquote>\n<p>This is a second blockquote</p>\n</blockquote>\n"
@axel584
Copy link

axel584 commented Nov 2, 2022

I've the same problem.

I have an application for which I want to replace the "kramdown" library for "redcarpet".

And for now, with kramdown, the behavior seems correct :

puts Kramdown::Document.new("This is a paragraph\n\n> This is a multiline\n> \n> blockquote\n\n> This is a second blockquote\n").to_html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants