Skip to content

Conversation

@aduh95
Copy link
Contributor

@aduh95 aduh95 commented Jul 3, 2018

A backslash at the end of the line is a hard line break.

Ref: https://spec.commonmark.org/0.28/#example-293
Ref: https://spec.commonmark.org/0.28/#example-606
Ref: https://spec.commonmark.org/0.28/#example-609
Ref: https://spec.commonmark.org/0.28/#example-611

Marked version: master#b67b5fd2fcf9fd93e26ffbf10e20455803089467

Markdown flavor: CommonMark

Description

line 1  
line 2\
line 3

Expectation

<p>line 1<br>
line 2<br>
line 3</p>

Result on commonmark.js demo

Result

<p>line 1<br>line 2\
line 3</p>

Result on Marked Demo

What was attempted

I added the backslash rule to the br RegEx.

Contributor

  • Test(s) exist to ensure functionality and minimize regression (if no tests added, list tests covering this PR); or,
  • no tests required for this PR.
  • If submitting new feature, it has been documented in the appropriate places.

Committer

In most cases, this should be a different person than the contributor.

  • Draft GitHub release notes have been updated.
  • CI is green (no forced merge required).
  • Merge PR

@styfle
Copy link
Member

styfle commented Jul 6, 2018

Thanks!

@styfle styfle merged commit 2f86d94 into markedjs:master Jul 6, 2018
@styfle styfle added this to the 0.5.0 - Commonmark Compliance milestone Aug 15, 2018
zhenalexfan pushed a commit to zhenalexfan/MarkdownHan that referenced this pull request Nov 8, 2021
add hard line break when backslash at EOL
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

Successfully merging this pull request may close these issues.

3 participants