A line ending with two spaces does not produce a hard line break
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
@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
- Ngôn ngữ chính
- TypeScript
- Star
- 433
- Fork
- 12
- Merge trung bình
- 29 phút
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TanStack/markdown
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
-
Strong ending in nested emphasis (`**bold *italic***`) closes early and leaves a literal `*`Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 70/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
Tất cả issue của TanStack/markdown
Issue tương tự
-
inference/go type/feature
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
anomalyco/opencode#65148 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
truapi-release
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
paritytech/product-sdk#529 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add: Mansudae TVĐang mởapproved check:passed streams:add
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Perf] Canvas layer composition is quadratic: splitRenderLayers re-copies the node array per nodeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
devlikeapro/waha#2369 ·
Maintainer thường phản hồi trong vòng 5 ngày