Incremental QMD writer drops bytes outside the first-to-last block range
Maintainer thường phản hồi trong vòng 1 ngày
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
- 76/100
Hướng nghiên cứu
Start with crates/pampa/src/writers/incremental.rs, especially assemble and emit_metadata_prefix, then trace how block offsets are obtained through SourceInfo::preimage_in. Reproduce both cases with qmd_to_pandoc, compute_reconciliation(&original, &original), and incremental_write. Done means unchanged input, including front matter and trailing blank lines, is reproduced byte for byte.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Reproduction
At tag v0.37.0 (and on main at a37801fe4), parse with pampa::wasm_entry_points::qmd_to_pandoc, compute quarto_ast_reconcile::compute_reconciliation(&original, &original) (no edit), and call pampa::writers::incremental::incremental_write.
Input A (33 bytes, front matter only, no body blocks):
---
title: Only front matter
---
Output: the empty string. The front matter is lost.
Input B (36 bytes):
First paragraph.
Last paragraph.
Output: 34 bytes; the two trailing blank lines after Last paragraph. are dropped. Editing any block in the document drops the trailing blank lines the same way — the bytes are not anchored to a block that survives editing.
Observed vs expected
Observed: with no edits, the output differs from the input — it is missing either the whole document (when it has no blocks) or the bytes after the last block (when it has one or more).
Expected: with no edits, the output equals the input exactly. Bytes before the first block (when front matter is unchanged) and bytes after the last block are copied verbatim from the original, the same way the gap between two kept blocks already is.
Cause
In crates/pampa/src/writers/incremental.rs:
assemblewalks the coarsened block list and emits a metadata prefix, then each block with its separator, but never emits anything for the region from the end of the last block to the end of the input. There is no "epilogue" step mirroring the "prefix" step.emit_metadata_prefixcomputesfirst_block_startasNonewhenoriginal_ast.blocksis empty, which means "no metadata prefix region" — so a document that is entirely front matter (zero body blocks) never has its front matter copied or rewritten at all.
Suggested fix
In assemble, after the main block loop, append original_qmd[last_block_end..] where last_block_end is the original AST's last block's end offset (via SourceInfo::preimage_in), when that block list is non-empty. In emit_metadata_prefix, treat a blocks-empty document's "first block start" as original_qmd.len() instead of None, so the whole document is considered the candidate metadata-prefix region instead of being skipped outright.
- Ngôn ngữ chính
- Rust
- Star
- 302
- Fork
- 22
- Merge trung bình
- 5 giờ 2 phút
- Pull request đã merge (30 ngày)
- 213
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 quarto-dev/q2
-
`dir: rtl` isn't written to `<html>` in HTML outputCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
quarto-dev/q2#1219 ·
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 75/100
quarto-dev/q2#1188 · 3 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 73/100
quarto-dev/q2#1179 ·
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 82/100
quarto-dev/q2#1133 ·
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 76/100
quarto-dev/q2#1103 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của quarto-dev/q2
Issue tương tự
-
priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
storytold/photocraft#15350 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:davinci
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ubugeeei-prod/vize#13167 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:ui enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
transit-audio/transit#738 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 91/100
hocinehacherouf/liberarr#78 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày