Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Fix markdown formatting issues in TUI streaming: block-level element newline omission and consecutive empty line accumulation

Đang mở Phù hợp với người mới
#3,259 7 bình luận 0 reaction 0 người được giao Xem trên GitHub

@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
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ệ
rust
Lĩnh vực
cli

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):

  1. Newline omission / output stickiness: When a text description is immediately followed by a block-level element (e.g., a fenced code block), pulldown-cmark does 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.
  2. 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) or ensure_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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ultraworkers/claw-code

Tất cả issue của ultraworkers/claw-code

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.