`Q-2-49` warns on a span with an empty attribute block, `[text]{}`
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 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:
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), andq2 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 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
quarto-dev/q2 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
quarto-dev/q2#1219 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 73/100
quarto-dev/q2#1179 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
quarto-dev/q2#1133 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
quarto-dev/q2#1103 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
quarto-dev/q2#1095 ·
维护者通常 1 天内回复
相似的 Issue
-
Selected chart highlights only its values, not its series names and category labels可能已有人在做 @Higgs32584 今天认领。 未关闭bug priority: low ui
难度 2/5 1-3 小时 新手友好度 82/100
storytold/gridcraft#4390 · 2 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
bug bugfix priority: medium
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 65/100
BurntSushi/jiff#713 ·
维护者通常 1 天内回复