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

Markdown does not add line break bug #49986

Closed
khanakia opened this issue Feb 6, 2024 · 4 comments
Closed

Markdown does not add line break bug #49986

khanakia opened this issue Feb 6, 2024 · 4 comments

Comments

@khanakia
Copy link

khanakia commented Feb 6, 2024

Laravel Version

10.43.0

PHP Version

8.1.27

Database Driver & Version

No response

Description

When converting markdown it does add the line break automatically. It should add the line break for each line

echo Str::markdown(<<<Markdown
      id
      sem_id - integer
      ref - string
      Markdown);

Generated Output

<p>
  id
  sem_id - integer
  ref - string
</p>

Expected Output

<p>
  id<br>
  sem_id - integer<br>
  ref - string
</p>

Steps To Reproduce

echo Str::markdown(<<<Markdown
      id
      sem_id - integer
      ref - string
      Markdown);
Copy link

github-actions bot commented Feb 6, 2024

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

@rojtjo
Copy link
Contributor

rojtjo commented Feb 6, 2024

As far as I know line breaks are only added in Markdown if a line ends with two or more spaces.
These seem to be missing in your example.

Please note that editors often automatically trim trailing whitespace, so you might have to change some settings to assure these remain.

@khanakia
Copy link
Author

khanakia commented Feb 6, 2024

You can check other markdown editor even the current GitHub comment editor check I just added the items below without any spaces and they are still have linebreak

id
sem_id - integer
ref - string

@rojtjo
Copy link
Contributor

rojtjo commented Feb 6, 2024

I don't think the GitHub comment section is a good example for this. They indeed do add additional line breaks, but looking at the spec of both Markdown and CommonMark it does state that a line needs to end in two or more spaces.

See:
https://daringfireball.net/projects/markdown/syntax#p
https://spec.commonmark.org/0.31.2/#hard-line-breaks

@khanakia khanakia closed this as completed Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants