HarryChen0506 / react-markdown-editor-lite

a light-weight Markdown editor based on React. 一款轻量的基于React的markdown编辑器
https://harrychen0506.github.io/react-markdown-editor-lite/
MIT License
1.02k stars 161 forks source link

[BUG] Keyboard Enter doesn't take to new line in preview mode #258

Open punithbm opened 2 years ago

punithbm commented 2 years ago

When I try to press enter to insert a new line under MD editor it doesn't go to a new line in the preview. If the user presses keyboard enter twice then it's taking to a new line. Please find the attached video. Also, let me know if there is any walkaround or any solution to address this.

https://user-images.githubusercontent.com/13044958/163978835-84c06df3-d50f-4890-b911-1c915b9e21ad.mp4

SonicMagna commented 2 years ago

For markdown, you need 2 spaces at the end of a line to indicate a new line. In the editor type this, button presses indicated in []:

Line one[space bar][space bar][enter] Line two

That's actually a markdown thing, not specific to this package. https://www.markdownguide.org/basic-syntax/#line-breaks

Because seeing those whitespaces can be problematic, I typically use HTML <br />, but that's up to you. Hope that helps :)