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

未关闭 适合新手
#1,188 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
75/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust
领域
backend

调研方向

从 crates/quarto-core/src/transforms/reference_link_diagnostics.rs 中链接到的检查(第 114–121 行)开始,追踪它如何区分缺失的属性块和空属性块。用提供的 index.qmd 示例复现,并将警告与渲染出的 span 进行比较。完成标准是 [10]{} 渲染为不带 Q-2-49 的 span,而单独的 [10] 仍会触发预期的警告。

由索引模型根据 Issue 内容生成。

描述

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.
主要语言
Rust
星标
302
派生
22
平均合并
5 小时 2 分钟
30 天内合并 PR
213

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

quarto-dev/q2 的其他 Issue

查看 quarto-dev/q2 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。