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

parsing of hard-linebreak then space inside block-quote: >\\\n A #213

Closed
mikeando opened this issue May 14, 2022 · 4 comments
Closed

parsing of hard-linebreak then space inside block-quote: >\\\n A #213

mikeando opened this issue May 14, 2022 · 4 comments

Comments

@mikeando
Copy link
Contributor

The markdown dingus (and my alternate implementation) says that

>\
 A

should parse as

  <block_quote>
    <paragraph>
      <linebreak />
      <text>A</text>
    </paragraph>
  </block_quote>

And gives the HTML

<blockquote>
<p><br />
A</p>
</blockquote>

Note that there is no space before the A.

In contrast, comrak retains the space before the A, giving the HTML:

<blockquote>
<p><br />
 A</p>
</blockquote>

I think the correct behaviour is to remove the leading space as the spec contains:

6.7Hard line breaks
...
Leading spaces at the beginning of the next line are ignored:

@mikeando
Copy link
Contributor Author

I'm happy to see if this is going to be easy to fix if you think it is worthwhile.

@mikeando
Copy link
Contributor Author

Seems that the issue is restricted to the \\\n kind of hard-linebreak. The ␣␣\n kind seems to work fine.
Also, it is not due to the otherwise empty first line.

> A\
␣B

generates the leading space,

<blockquote>
<p>A<br />
␣B</p>
</blockquote>

while

> A␣␣
␣B

does not generate the leading space.

<blockquote>
<p>A<br />
B</p>
</blockquote>

@mikeando
Copy link
Contributor Author

mikeando commented May 14, 2022

Similarly, the non-lazy form works as expected too.

>␣A\
>␣B

gives no extra space

<blockquote>
<p>A<br />
B</p>
</blockquote>

@kivikakk
Copy link
Owner

Closed by #214 — thanks!

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