Parser: a stray `{key=value}` in a paragraph is accepted silently (passes --dry-run, dropped in HTML)

Đang mở
#1,444 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
tooling

Hướng nghiên cứu

Start by tracing how q2 parses standalone attributes and how q2 render --dry-run reports parse problems; the issue does not name source files or tests. Reproduce with Text {colspan=2} here. and compare dry-run with HTML and docx output. Done means dry-run reports the stray attribute with its location, and rendering no longer silently drops the text.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Tested with q2 0.48.0 on Windows 11. Split from #1322, which now covers only the JSON writer's hidden diagnostics.

A {key=value} block in the middle of a paragraph is accepted as a standalone attribute with nothing to attach to. Nothing reports it:

  • q2 render --dry-run finds no problems.
  • --to html succeeds and drops the text without a warning.
  • --to docx (and other formats that go through pandoc) fails in the JSON writer with "Standalone attribute not supported in JSON format" (see #1322).

This happens easily after pasting text, or when trying an attribute somewhere q2 doesn't support one (for example a list-table cell attribute outside a list table).

Repro

Text {colspan=2} here.
$ q2 render s4.qmd --dry-run
Checked 1 file — no problems found

$ q2 render s4.qmd --to html
<p>Text  here.</p>

Proposal: report a standalone attribute that has nothing to attach to at parse time, with its location:

  • An error, not a warning. It already stops every format that goes through pandoc, so making it an error everywhere means HTML and docx behave the same. HTML stops losing text without saying so, and --dry-run catches what a docx render would fail on.
  • A new Q-code, with a hint that attributes go directly after a span ([text]{key=value}), a heading, or a div/code fence.

If a warning that keeps the text as literal text fits q2 better, that would also solve it for us. What matters is that --dry-run reports it.

Ngôn ngữ chính
Rust
Star
321
Fork
23
Merge trung bình
11 giờ 39 phút
Pull request đã merge (30 ngày)
251

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 quarto-dev/q2

Tất cả issue của quarto-dev/q2

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.