You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A line ending with two spaces does not produce a hard line break #42
@tanstack/markdown 1.2.0 does not produce a hard line break when a line ends with two or more spaces. CommonMark requires one, and react-markdown 9.1.0 renders it. Only the backslash form (\ before the newline) produces a break node.
Tested with React 19 renderToStaticMarkup and no options. · marks a space in the input column.
Input
@tanstack/markdown 1.2.0
react-markdown 9.1.0
a··\nb (2 trailing spaces)
<p>a\nb</p>
<p>a<br/>\nb</p>
a···\nb (3 trailing spaces)
<p>a\nb</p>
<p>a<br/>\nb</p>
a··\r\nb (CRLF)
<p>a\nb</p>
<p>a<br/>\nb</p>
a\ + newline + b (backslash)
<p>a<br/>b</p>
<p>a<br/>\nb</p>
a\nb (plain newline)
<p>a\nb</p>
<p>a\nb</p>
Two or more trailing spaces before a newline are never turned into a hard break. This holds for LF and CRLF line endings.
The backslash hard break works, and a plain newline correctly stays a soft break.
CommonMark (spec: hard line breaks) says two or more spaces at the end of a line, with more text after it in the same paragraph, are a hard line break.
I only checked @tanstack/markdown/react, not @tanstack/markdown/html, and only version 1.2.0.
Edit: And yes, I understand that full CommonMark compliance is not in the project scope, but this seems like a relatively easy addition
changed the title [-]A line ending with to spaces does not produce a linebreak[/-][+]A line ending with two spaces does not produce a linebreak[/+]on Nov 18, 2026
changed the title [-]A line ending with two spaces does not produce a linebreak[/-][+]A line ending with two spaces does not produce a hard line break[/+]on Nov 18, 2026
Activity
[-]A line ending with to spaces does not produce a linebreak[/-][+]A line ending with two spaces does not produce a linebreak[/+][-]A line ending with two spaces does not produce a linebreak[/-][+]A line ending with two spaces does not produce a hard line break[/+]