Fix markdown formatting issues in TUI streaming: block-level element newline omission and consecutive empty line accumulation
@Aditaya08 đang làm issue này rồi.
Từ ngày 19/8/2026.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Bắt đầu trong render.rs, tập trung vào các trình xử lý sự kiện Markdown được TUI streaming sử dụng ở chế độ không compact và các sự kiện bắt đầu và kết thúc ở cấp khối được mô tả trong issue. Xác minh kết quả với các phần mô tả theo sau là fenced code blocks và nội dung danh sách lồng nhau: các đường viền không được dính vào văn bản phía trước, và phần kết thúc khối không được để lại quá một dòng trống.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
When rendering Markdown text in TUI streaming mode (specifically in non-compact mode):
- Newline omission / output stickiness: When a text description is immediately followed by a block-level element (e.g., a fenced code block),
pulldown-cmarkdoes not emit any line-break or soft-break events between them. This results in the code block top border rendering immediately after the text (e.g.,2. Enter directory:╭─ code), causing layout stickiness. - Consecutive empty line accumulation: Multiple block closing events (such as code block end + list item end + list end) consecutively append newlines unconditionally. This leads to redundant empty lines stacking up in the terminal (e.g., 3-4 consecutive empty lines), which wastes screen space.
Solution / Implementation
We solved this by introducing an idempotent, smart newline-ensuring helper:
fn ensure_newlines(output: &mut String, count: usize) {
if output.is_empty() {
return;
}
let current = output.chars().rev().take_while(|&c| c == '\n').count();
if current < count {
output.push_str(&"\n".repeat(count - current));
}
}
And applied it defensively to block-level start/end event handlers in render.rs:
- Code Block Start / Item Start / Blockquote Start: Call
ensure_newlines(output, 1)to prevent inline stickiness. - Heading Start: Call
ensure_newlines(output, 2)to ensure space before headers. - Block End Events: Replace unconditional newline pushing with
ensure_newlines(output, 2)(for paragraphs, headings, lists, table closings) orensure_newlines(output, 1)(for items, blockquotes), which prevents consecutive newlines from accumulating beyond 1 empty line.
- Ngôn ngữ chính
- Rust
- Star
- 195k
- Fork
- 108k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- 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 ultraworkers/claw-code
-
fix(cli): resolve duplicate assistant text printing after 'Done' in non-compact text modeCó thể đã có người làm @nankingjing đã nhận 90 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ultraworkers/claw-code#3258 · 1 bình luận ·
-
bug: Missing newlines before paragraphs and code blocks in streamed Markdown renderingCó thể đã có người làm @nankingjing đã nhận 90 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ultraworkers/claw-code#3257 · 2 bình luận ·
-
[CRITICAL][SECURITY] Untrusted project hooks bypass read-only mode for arbitrary command executionĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 68/100
ultraworkers/claw-code#3301 · 4 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
ultraworkers/claw-code#3300 · 2 bình luận ·
-
Pin all third-party GitHub Actions to immutable commit SHAs across CI workflowsCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
ultraworkers/claw-code#3287 · 6 bình luận · 1 reaction ·
Tất cả issue của ultraworkers/claw-code
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
element-hq/lk-jwt-service#248 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged bug bughunt pm:pipenv priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SocketDev/socket-patch#1219 · 1 bình luận ·
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 78/100
pact-foundation/pact-cli#154 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
antithesishq/bombadil#361 ·
Maintainer thường phản hồi trong vòng 1 ngày