A page with no headings gets `fullcontent`, so the floating sidebar moves between pages
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ó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 67/100
Hướng nghiên cứu
Start by tracing how q2 decides whether to add fullcontent and render #quarto-margin-sidebar when the TOC is enabled but a page has no headings; compare that path with the toc: false case and the behavior described for Quarto 1. The repro provides a three-page website and expected body classes and sidebar counts. Reproduce with q2 render; done means page B keeps the floating layout and margin sidebar, while page C with toc: false still gets fullcontent.
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
When the TOC is on but a page has no headings, q2 leaves out the right margin sidebar
(#quarto-margin-sidebar) and adds fullcontent to <body>. The theme gives
body.floating.fullcontent a different grid from body.floating: it has no TOC columns and it
has fixed gutters. So on a site with a floating sidebar, the sidebar and the body column move
when you go from a page with headings to a page without headings. In our site, at a 1708px
window the sidebar moves 125px to the right. Between 992px and about 1200px the sidebar is also
wider (250px instead of 191px).
Quarto 1 does not do this. It keeps the empty margin sidebar on a page with no headings and does
not add fullcontent, so the layout stays the same from page to page. Quarto 1 adds
fullcontent only when the page sets toc: false, and q2 does the same in that case.
This could be the same logic as #1371: q2 adds fullcontent when it thinks nothing uses the
right margin. Here the trigger is an empty TOC, not .column-margin content.
Steps to reproduce
mkdir sidebar-shift && cd sidebar-shift
printf 'project:\n type: website\nwebsite:\n title: t\n sidebar:\n style: floating\n contents: [a.qmd, b.qmd, c.qmd]\nformat:\n html:\n toc: true\n' > _quarto.yml
printf -- '---\ntitle: A\n---\n\n## One\n\ntext\n\n## Two\n\ntext\n' > a.qmd
printf -- '---\ntitle: B\n---\n\nNo headings here.\n' > b.qmd
printf -- '---\ntitle: C\ntoc: false\n---\n\n## One\n\ntext\n' > c.qmd
q2 render
for p in a b c; do
echo "$p: $(grep -o '<body class="[^"]*"' _site/$p.html) margin-sidebar=$(grep -c 'id="quarto-margin-sidebar"' _site/$p.html)"
done
Open _site/a.html and _site/b.html in a browser wider than 992px and switch between them.
The sidebar moves.
Actual behavior
With q2 0.47.0 and with 0.45.0-nightly.20261112:
a: <body class="nav-sidebar floating quarto-light" margin-sidebar=1
b: <body class="nav-sidebar floating fullcontent quarto-light" margin-sidebar=0
c: <body class="nav-sidebar floating fullcontent quarto-light" margin-sidebar=0
Expected behavior
The same as Quarto 1.11.9, with the same files and quarto render:
a: <body class="nav-sidebar floating quarto-light" margin-sidebar=1
b: <body class="nav-sidebar floating quarto-light" margin-sidebar=1
c: <body class="nav-sidebar floating fullcontent quarto-light" margin-sidebar=0
Page b has no headings, but because toc is on it keeps the margin sidebar and the
body.floating grid. Only page c, which sets toc: false, gets fullcontent.
Workaround
We give body.nav-sidebar.floating.fullcontent .page-columns the theme's body.floating
grid-template-columns values, for min-width: 992px and for 768px–991.98px. This copies
the theme's grid values, so it can drift when the theme changes.
Environment
- q2 0.47.0 (latest release) and 0.45.0-nightly.20261112, macOS arm64
- Quarto 1.11.9 for the comparison
- Same result with the
posit-dev/product-doc-theme@q2(posit-docs) extension, and with the
plainwebsiteproject type in the repro above
- 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
-
Heading anchor links have no icon: AnchorJS is initialised with an empty `icon`Có thể đã có người làm @cscheid đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
quarto-dev/q2#1419 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
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
-
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ự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
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 68/100
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 82/100
BurntSushi/jiff#755 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
After the kernel is given up on, a new import leaves "Importing…" and its Cancel on the status lineĐang mởbug help wanted priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
sawhorse3d/sawhorse#163 ·
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 82/100
MartinPTielemans/ilo#4607 ·