An HTML dependency's stylesheet loses the files it refers to with `url()`, such as fonts
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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Start with crates/quarto-core/src/dependency.rs and crates/pampa/src/lua/quarto_doc.rs, which the issue identifies as the dependency storage and Lua API paths. Compare q2's copying of stylesheets and scripts with the Quarto 1 behavior described, including CSS url() and @import references. Use the reproduction steps in the issue to render page.qmd; done means the referenced font and declared resources appear in the output and the browser no longer gets a 404.
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 filter adds an HTML dependency with quarto.doc.add_html_dependency, Quarto 1 copies
the stylesheet and also each file it refers to with url() or @import, such as a font
(cssFileResourceReferences in core/css.ts). The files go next to the stylesheet, so the
relative references still work. Quarto 1 also copies the dependency's resources.
q2's store_html_dependencies (crates/quarto-core/src/dependency.rs, line 92) copies only
stylesheets and scripts. add_html_dependency warns that resources is "not yet supported
and will be ignored" (UNSUPPORTED_FIELDS in crates/pampa/src/lua/quarto_doc.rs, line 63).
So an extension that ships a font with its stylesheet has no way to get the font into the
output. The browser's request for it returns 404, and the text falls back to another font.
Great Docs' terminal-recording extension ships JetBrains Mono this way. Its post-render script
works around the problem by copying the files an extension stylesheet refers to next to the
copy in site_libs.
Steps to reproduce
mkdir fonts && cd fonts
mkdir -p _extensions/player
cat > _extensions/player/_extension.yml <<'YML'
title: Player
version: 1.0.0
contributes:
filters:
- player.lua
YML
cat > _extensions/player/player.lua <<'LUA'
function Pandoc(doc)
quarto.doc.add_html_dependency({
name = "player",
version = "1.0.0",
stylesheets = { "player.css" },
resources = { "notes.txt" },
})
return doc
end
LUA
cat > _extensions/player/player.css <<'CSS'
@font-face {
font-family: "Mono";
src: url(Mono.woff2) format("woff2");
}
CSS
printf 'font' > _extensions/player/Mono.woff2
printf 'notes' > _extensions/player/notes.txt
cat > page.qmd <<'QMD'
---
title: Fonts
filters:
- player
---
Some text.
QMD
q2 render page.qmd
find page_files -type f | grep player
Actual behavior
With q2 0.47.0, and with q2 built from main at d457b6924:
Warning [Q-11-1]: add_html_dependency: field 'resources' is not yet supported and will be ignored
page_files/libs/player/1.0.0/player.css
Neither Mono.woff2 nor notes.txt is copied.
Expected behavior
As in Quarto 1.9.37:
page_files/libs/quarto-contrib/player-1.0.0/Mono.woff2
page_files/libs/quarto-contrib/player-1.0.0/notes.txt
page_files/libs/quarto-contrib/player-1.0.0/player.css
Without the resources line, Quarto 1 still copies Mono.woff2, because player.css refers
to it.
- 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
-
Độ 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
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 ·