Heading anchor links have no icon: AnchorJS is initialised with an empty `icon`
Maintainer thường phản hồi trong vòng 1 ngà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
- 78/100
Hướng nghiên cứu
Bắt đầu với INIT_SCRIPT trong crates/quarto-core/src/transforms/anchor_sections.rs và so sánh cách thiết lập AnchorJS với hành vi của Quarto 1 được mô tả trong issue. Kết quả được báo cáo cho thấy biểu tượng được tạo ra đang trống; hãy xác minh bản sửa bằng cách render bản tái hiện website được cung cấp và kiểm tra xem liên kết tiêu đề có hiển thị biểu tượng của AnchorJS hay không.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
This issue was drafted with Claude. The output shown comes from running each repro.
Bug description
Heading anchor links have no icon. q2 adds the .anchorjs-link to each heading, and the link
appears on hover, but it is empty, so readers cannot see or click it.
q2 initialises AnchorJS with icon: ''. Quarto 1 passes a one-character string, U+E9CB, a
private-use glyph that AnchorJS draws with its own anchorjs-icons font. When icon is that
glyph, AnchorJS also sets font: 1em/1 anchorjs-icons on the link. With an empty string it
draws content: attr(data-anchorjs-icon), which is empty.
The cause looks like an invisible character that was lost when the init was ported. In Quarto
1's quarto-html-after-body.ejs (line 75), the line reads
const icon = "<%= anchors === true ? '' : anchors %>";, but the quotes hold U+E9CB:
$ sed -n 75p share/formats/html/templates/quarto-html-after-body.ejs | xxd | sed -n 3p
00000020: 3d20 7472 7565 203f 2027 eea7 8b27 203a = true ? '...' :
In q2, INIT_SCRIPT in crates/quarto-core/src/transforms/anchor_sections.rs (at 9bf91d18c)
has a truly empty string, and its doc comment says "with icon empty, which is what Q1 renders
for anchors === true":
$ sed -n 126p crates/quarto-core/src/transforms/anchor_sections.rs | xxd
00000000: 2020 2020 6963 6f6e 3a20 2727 5c6e 5c0a icon: ''\n\.
Steps to reproduce
mkdir anchor-icon && cd anchor-icon
printf 'project:\n type: website\nwebsite:\n title: Demo\n' > _quarto.yml
printf -- '---\ntitle: Anchors\n---\n\n## A heading\n\nText.\n' > index.qmd
q2 render
grep -o "icon: [^,}]*" _site/index.html | xxd
Then open _site/index.html and hover over "A heading". There is a link target after the heading
text, but nothing is drawn.
Actual behavior
With q2 0.47.0 and with 0.45.0-nightly.20261112:
00000000: 6963 6f6e 3a20 2727 0a icon: ''.
Expected behavior
Quarto 1.11.9 with the same files (quarto render, then
grep -o 'const icon = "[^"]*"' _site/index.html | xxd):
00000000: 636f 6e73 7420 6963 6f6e 203d 2022 eea7 const icon = "..
00000010: 8b22 0a .".
Hovering over the heading shows AnchorJS's link icon.
A possible fix is to write the glyph as an escape in INIT_SCRIPT (icon: '', which is
'\\ue9cb' inside the Rust string), so it cannot be lost again.
Workaround
.anchorjs-link[data-anchorjs-icon=""]::after {
content: "\e9cb";
font: 1em/1 anchorjs-icons;
}
AnchorJS registers the anchorjs-icons font whenever it adds links, so this draws the same icon
as Quarto 1, and it stops applying once the icon is set.
Environment
- q2 0.47.0 (latest release) and 0.45.0-nightly.20261112, macOS arm64
- Quarto 1.11.9 for the comparison
- Ngôn ngữ chính
- Rust
- Star
- 316
- Fork
- 23
- Merge trung bình
- 11 giờ 49 phút
- Pull request đã merge (30 ngày)
- 245
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
-
bug testing windows
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
quarto-dev/q2#1346 ·
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#1095 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 67/100
quarto-dev/q2#1418 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug readers-writers windows
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
quarto-dev/q2#1416 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Most knitr engines are not yet supported: {cat}, {css}, {Rcpp}... cells go to JupyterCó thể đã có người làm @cderv đã nhận 3 ngày trước. Đang mởfeature-port
quarto-dev/q2#1413 · 1 bình luận · 1 người được giao ·
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ự
-
needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
pbakaus/impeccable#1718 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged bug bughunt pm:bazel priority:p3 ux
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
SocketDev/socket-patch#2386 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Uncaught index-out-of-bounds panic in `minijinja::value::ops::slice` on `{{ ''[::-1] }}` (v2.24.0)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Fix All + Enforce overwrites unsaved edits to .editorconfig / Directory.Build.props / sharplsp.tomlĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Nimblesite/SharpLsp#644 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày