mdx-editor / editor

A rich text editor React component for markdown
https://mdxeditor.dev
MIT License
1.63k stars 131 forks source link

[BUG] More than 1 new lines are not rendered in the editor #429

Closed ChrisCoy closed 3 months ago

ChrisCoy commented 3 months ago

If you put a content in the editor that has more than 1 new line "\n" it will render only the content in each <p> tag. For example:

the text "text\n\n\ntext" will generate <p>text</p><p>text</p>

I dont know if this is really a bug but at least is a strange behavior that i do not expect as a developer.

I expect it to render the new line as a p tag without content.

Heres the codesandbox: https://codesandbox.io/p/sandbox/mdx-editor-base-forked-f4wgvr?file=%2Fsrc%2FApp.tsx%3A21%2C5-21%2C72

petyosi commented 3 months ago

This is not a matter of expectations. The markdown spec defines this behavior:

A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line — a line containing nothing but spaces or tabs is considered blank.)

ChrisCoy commented 3 months ago

I see, sorry for the useless issue, is there anyway i can change this behavior?