`Q-2-49` warns on a span with an empty attribute block, `[text]{}`

Đang mở Phù hợp với người mới
#1,188 3 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
75/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
backend

Hướng nghiên cứu

Bắt đầu với phần kiểm tra được liên kết trong crates/quarto-core/src/transforms/reference_link_diagnostics.rs (các dòng 114–121) và lần theo cách nó phân biệt khối thuộc tính bị thiếu với khối rỗng. Tái hiện bằng ví dụ index.qmd được cung cấp và so sánh cảnh báo với span được kết xuất. Hoàn thành khi [10]{} được kết xuất thành span mà không có Q-2-49, còn [10] trần vẫn đưa ra cảnh báo như dự kiến.

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

Mô tả

Bug description

Each value box number in the metrics dashboard from #1131 comes from Python as Markdown("[" + value + "]{}"), and every render warns 12 times with Q-2-49.
The {} is there to make it a span, but the warning says the group "has no attribute block".

Pandoc reads [10]{} as a Span with an empty attribute, while a bare [10] stays literal text.
q2 renders [10]{} as <span>10</span>, like Quarto 1, so the output is right and only the warning is off.
An empty {} is admittedly an edge case, but it is a handy way to get a plain <span> in the HTML DOM, for example to target the value from CSS or JavaScript, and generated Markdown like this produces it easily.

The check looks at the parsed attribute, which is empty in both cases, so [10]{} and [10] look the same to it:

https://github.com/quarto-dev/q2/blob/a76c96abfe2effc9872b572b201d6f772a89161e/crates/quarto-core/src/transforms/reference_link_diagnostics.rs#L114-L121

Steps to reproduce

index.qmd:

---
title: Hello
---

A [10]{} B and [x]{.y} C.
q2 render index.qmd
quarto render index.qmd
Actual behavior

q2 renders <span>10</span> and warns:

Warning: [Q-2-49] `[10]` has no attribute block, so it renders as an empty span and the brackets are discarded — the reader sees `10`. Write `\[10\]` to keep the brackets literal, or `[10]{.class}` if a span was intended.
   ╭─[ <dir>/index.qmd:5:3 ]
   │
 5 │ A [10]{} B and [x]{.y} C.
   │   ───┬──

Quarto 1 renders the same <span>10</span> with no warning.

Expected behavior

No Q-2-49 when the source has an attribute block, even an empty one, since {} already says that a span is intended.

Your environment
  • q2: q2 (quarto 2) 0.45.0-nightly.20261112 (nightly built from a76c96a), and q2 v0.44.0.
  • Quarto 1 for comparison: development build of quarto-dev/quarto-cli@fa74261.
  • OS: macOS 27.2 (arm64).
  • Terminal, no IDE.
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

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.