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

Line break does not work #268

Open
thongdong7 opened this issue Jul 7, 2024 · 1 comment
Open

Line break does not work #268

thongdong7 opened this issue Jul 7, 2024 · 1 comment

Comments

@thongdong7
Copy link

Hi guys.

Thank you for your time to develop this awesome library.

I'm recently figure out that the line break in markdown is not rendered correctly. Example:

<MarkdownPreview
   source={`
Hello.
World

    `}
        style={{ padding: 16 }}
      />

will render

Hello. World

instead of

Hello. 
World

Do you know how to fix it?

Thanks

@jaywcjlove
Copy link
Member

@thongdong7 In standard Markdown, there are a few ways to create line breaks:

  1. Single line break: Add two spaces at the end of a line followed by Enter. This method is considered standard for creating a line break in Markdown.

    This is the first line.  
    This is the second line.
  2. Paragraph break: Insert an empty line between paragraphs to create a break. This is also a standard way to separate paragraphs in Markdown.

    This is the first paragraph.
    
    This is the second paragraph.
  3. HTML tag: Use the <br> tag to create a line break. While not purely Markdown, this method is commonly used and supported.

    This is the first line.<br>
    This is the second line.

These three methods can be used to create line breaks in Markdown, with the first two being standard Markdown practices.

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