question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Line breaks are not respected in blockquotes, and inline code blocks

See original GitHub issue

Initial checklist

Affected packages and versions

react-markdown@7.0.1

Link to runnable example

https://codesandbox.io/s/still-monad-5p15j?file=/src/app.tsx

Steps to reproduce

It appears that line breaks for blockquotes aren’t respected and they all get merged into one line. To reproduce use this markdown:

> each one of these
> should be on
> a new line

Expected behavior

The expected output is something like this:

<blockquote>
  each one of these<br/>
  should be on<br/>
  a new line
</blockquote>

or

<blockquote>
  <p>each one of these</p>
  <p>should be on</p>
  <p>a new line</p>
</blockquote>

Actual behavior

The actual current output is:

<blockquote>
  <p>
    each one of these
    should be on
    a new line
  </p>
</blockquote>

Runtime

Node v16

Package manager

yarn v1

OS

macOS

Build and bundle tools

Webpack

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
EvHauscommented, Nov 30, 2021

remark-breaks was what I needed. Sorry I missed that and thanks for the quick response!

0reactions
EvHauscommented, Feb 11, 2022

@get-codin Hmm. For me, just adding remark-breaks did the trick. I’m using it through react-markdown so the implementation is a bit different.

I did notice that the order of plugins often makes a big difference. Maybe try swapping the order of .use(html) and .use(remarkBreaks)?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiline block quotes does not respect new lines - GitLab
Summary When using markdown I've noticed that block quotes both normal and multiline do not behave well with newlines.
Read more >
Markdown no newlines in codeblock · Issue #7308 - GitHub
I can work around the issue by just making every single line of code its own block and adding 2 spaces to the...
Read more >
markdown - How to force a linebreak? - Stack Overflow
Line break in Markdown is "two or more spaces at the end of the line".
Read more >
Hard line breaks - CommonMark Spec
Blank lines between block-level elements are ignored, except for the role they play in determining whether a list is tight or loose. Blank...
Read more >
Paragraphs, Lines, and Phrases
A line break occurring immediately following a start tag must be ignored, as must a line break occurring immediately before an end tag....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found