A page's `body-classes` replaces the layout classes on `<body>` instead of adding to them
Maintainer thường phản hồi trong vòng 1 ngà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
- 72/100
Hướng nghiên cứu
Start with the body-classes handling in crates/quarto-core/src/template.rs, especially the comments at lines 201 and 1232 cited in the issue. Compare the rendered body classes from the provided q2 repro with the expected Quarto 1 output, then run the repro after the change. Done when page classes are added to computed layout classes while the plain page output remains correct.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
This issue was written by Claude while adding q2 support to Great Docs. The output shown comes from running each repro.
Bug description
When a page sets body-classes, q2 writes only those classes on <body>. The classes q2 computes
for the layout, such as nav-fixed, fullcontent and quarto-light, are dropped. Quarto 1 adds the
page's classes to the computed ones.
This looks intended: crates/quarto-core/src/template.rs:201 says a body-classes "supplied by the
author or a filter is kept wholesale and suppresses the compose below", and so does the comment at
:1232. But the theme's CSS and JavaScript select on those classes: nav-fixed for the fixed
navbar, fullcontent and the other layout classes for the page grid, and quarto-light for the
color scheme. So a page that adds one class of its own loses that styling.
Great Docs sets body-classes on its API and CLI reference pages (doc-reference,
doc-api-page and others), on blog index pages and on the tags index. Its CSS uses them to style
those pages. Under q2 each of those pages loses its layout classes. As a workaround, Great Docs' filter moves body-classes
into a <meta> tag, and a post-render script adds them to the classes q2 wrote.
Steps to reproduce
mkdir body-classes && cd body-classes
printf 'project:\n type: website\nwebsite:\n navbar:\n left: [index.qmd, plain.qmd]\n' > _quarto.yml
printf -- '---\ntitle: Home\ntoc: false\nbody-classes: my-page\n---\n\nHome.\n' > index.qmd
printf -- '---\ntitle: Plain\ntoc: false\n---\n\nPlain.\n' > plain.qmd
q2 render
grep -o '<body[^>]*>' _site/index.html _site/plain.html
Actual behavior
_site/index.html:<body class="my-page">
_site/plain.html:<body class="fullcontent nav-fixed quarto-light">
Expected behavior
As in Quarto 1.9.37:
_site/index.html:<body class="nav-fixed my-page fullcontent quarto-light">
_site/plain.html:<body class="nav-fixed fullcontent quarto-light">
Add the page's body-classes to the computed classes. If replacing them should still be possible,
an explicit opt-in such as !prefer would serve, rather than making replacement the default.
- Ngôn ngữ chính
- Rust
- Star
- 302
- Fork
- 22
- Merge trung bình
- 5 giờ 2 phút
- Pull request đã merge (30 ngày)
- 213
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
-
`dir: rtl` isn't written to `<html>` in HTML outputCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
quarto-dev/q2#1219 ·
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#1188 · 3 bình luận ·
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 73/100
quarto-dev/q2#1179 ·
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
quarto-dev/q2#1133 ·
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 76/100
quarto-dev/q2#1103 · 1 bình luận ·
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ự
-
priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
storytold/photocraft#15350 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:davinci
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ubugeeei-prod/vize#13167 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:ui enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
transit-audio/transit#738 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 91/100
hocinehacherouf/liberarr#78 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ 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