A line ending with two spaces does not produce a hard line break
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 72/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- typescript
研究方向
Start by tracing how @tanstack/markdown parses newline and backslash hard breaks; the issue does not name parser files or tests. Reproduce the two trailing spaces case with LF and CRLF, then compare the generated nodes with the working backslash case. Done when both inputs produce a hard break and plain newlines remain soft breaks.
由索引模型根據 Issue 內容生成。
描述
@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.
Reproduction
import { renderToStaticMarkup } from "react-dom/server";
import { Markdown } from "@tanstack/markdown/react";
renderToStaticMarkup(<Markdown>{"a \nb"}</Markdown>);
// actual: <p>a\nb</p>
// expected: <p>a<br/>\nb</p>
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
- 主要語言
- TypeScript
- 星號
- 433
- 分支
- 12
- 平均合併
- 29 分鐘
- 30 天內合併 PR
- 7
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
TanStack/markdown 的其他 Issue
-
難度 3/5 1-2 天 新手友好度 68/100
-
難度 4/5 3-5 天 新手友好度 48/100
-
難度 3/5 半天 新手友好度 70/100
-
難度 3/5 1-2 天 新手友好度 55/100
查看 TanStack/markdown 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
fb55/htmlparser2#2579 ·
維護者通常 1 天內回覆
-
bug good first issue needs-review
難度 1/5 1-3 小時 新手友好度 83/100
維護者通常 1 天內回覆
-
documentation public
難度 1/5 1-3 小時 新手友好度 68/100
midnightntwrk/umbradb#65 ·
維護者通常 2 天內回覆
-
area/channels kind/bug priority/medium
難度 2/5 1-3 小時 新手友好度 78/100
nanocoai/nanoclaw#4501 · 1 則留言 ·
維護者通常 1 天內回覆
-
needs verification
難度 2/5 1-3 小時 新手友好度 74/100
維護者通常 13 天內回覆