Heading anchor links have no icon: AnchorJS is initialised with an empty `icon`
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
crates/quarto-core/src/transforms/anchor_sections.rs の INIT_SCRIPT から始め、その AnchorJS の設定を issue に記載された Quarto 1 の動作と比較してください。報告された出力では生成されたアイコンが空になっています。提供されたウェブサイトの再現例をレンダリングし、見出しリンクに AnchorJS のアイコンが表示されることを確認して、修正を検証してください。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Rust
- スター
- 316
- フォーク
- 23
- 平均マージ
- 11時間 49分
- マージ済み PR(30日)
- 245
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
quarto-dev/q2 のほかの issue
-
bug testing windows
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
quarto-dev/q2#1346 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
quarto-dev/q2#1095 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 67/100
quarto-dev/q2#1418 ·
メンテナーはふだん 1 日以内に返信
-
bug readers-writers windows
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
quarto-dev/q2#1416 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Most knitr engines are not yet supported: {cat}, {css}, {Rcpp}... cells go to Jupyter対応中かも @cderv が 3 日前に担当しました。 オープンfeature-port
quarto-dev/q2#1413 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
pbakaus/impeccable#1718 ·
メンテナーはふだん 1 日以内に返信
-
agent:triaged bug bughunt pm:bazel priority:p3 ux
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
SocketDev/socket-patch#2386 ·
メンテナーはふだん 1 日以内に返信
-
Uncaught index-out-of-bounds panic in `minijinja::value::ops::slice` on `{{ ''[::-1] }}` (v2.24.0)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Fix All + Enforce overwrites unsaved edits to .editorconfig / Directory.Build.props / sharplsp.tomlオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
Nimblesite/SharpLsp#644 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信