Line breaks are not respected in blockquotes, and inline code blocks
See original GitHub issueInitial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and couldn’t find anything (or linked relevant results below)
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:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
remark-breaks
was what I needed. Sorry I missed that and thanks for the quick response!@get-codin Hmm. For me, just adding
remark-breaks
did the trick. I’m using it throughreact-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)
?