DecoratedCodeBlock has no docx/pptx renderer — code chunk `filename` header silently dropped
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
- 72/100
Hướng nghiên cứu
Start with src/resources/filters/customnodes/decoratedcodeblock.lua and compare the existing HTML and LaTeX renderers with the fallback path. Render the provided repro with --to docx and --to pptx, then verify that a visible filename representation appears before the code block while HTML and LaTeX behavior remains unchanged.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
A code block decorated with a filename (e.g. {r filename="hello.R"} or a .filename attribute) renders correctly in HTML, LaTeX, and Markdown output, but the filename header is silently dropped for docx and pptx (and any other format with no dedicated renderer registered).
Where the gap is
src/resources/filters/customnodes/decoratedcodeblock.lua registers exactly four renderers for the DecoratedCodeBlock custom AST node:
- A default/fallback renderer (predicate always
true) — walks the code block for folding only:_quarto.ast.add_renderer("DecoratedCodeBlock", function(_) return true end, function(node) return _quarto.ast.walk(node.code_block, { CodeBlock = render_folded_block }) end) - A markdown renderer (
_quarto.format.isMarkdownOutput()) - A latex renderer (
_quarto.format.isLatexOutput()) - An html renderer (
_quarto.format.isHtmlOutput())
Only the html and latex renderers actually read node.filename and render a header for it. Since docx/pptx match none of the three specific predicates, they fall through to the default renderer, which never reads node.filename (or node.caption) at all — it only walks for render_folded_block (itself a no-op for non-HTML output). The result: the code block content survives, but the filename header silently disappears, with no warning.
Repro
---
title: repro
---
```{.python filename="hello.py"}
print("hello")
Render with `quarto render repro.qmd --to docx` (or `--to pptx`). The code block appears; the "hello.py" filename header does not. Compare with `--to html` or `--to latex`, both of which show it.
## Suggested fix
Add a docx/pptx-aware renderer for `DecoratedCodeBlock` (or extend the default renderer to check `_quarto.format.isDocxOutput()`/`isPowerPointOutput()`) that emits *some* visible representation of `node.filename` — e.g. a bold paragraph immediately before the code block, mirroring the semantic intent of the html wrapper (`code-with-filename`) and the latex `\caption`, adapted to what Pandoc's docx/pptx writers can represent natively (Word/PowerPoint have no custom CSS to hook into, so this would need to be a plain paragraph/text run rather than a styled wrapper).
## Context
Found while auditing `decoratedcodeblock.lua`'s renderer coverage against Pandoc's non-core output targets (docx/pptx) for a project that reuses these filters. Confirmed against a fresh clone at `v1.11.3` (and current `main`, `83d48d8e8` — the file is unchanged between the two).
- Ngôn ngữ chính
- JavaScript
- Star
- 6.1k
- Fork
- 463
- Merge trung bình
- 21 giờ 10 phút
- Pull request đã merge (30 ngày)
- 61
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- 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/quarto-cli
-
bug callouts regression revealjs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
quarto-dev/quarto-cli#15014 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Website navbar hides the notebook preview headerCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởaccessibility bug embed websites
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
quarto-dev/quarto-cli#14972 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
accessibility documentation revealjs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
quarto-dev/quarto-cli#14971 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
accessibility revealjs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
quarto-dev/quarto-cli#14970 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
a11y: notebook preview header is outside any landmarkCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởaccessibility embed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
quarto-dev/quarto-cli#14968 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của quarto-dev/quarto-cli
Issue tương tự
-
agent/scanner bug hive/hosted-available-lke648397-260827-5n31
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/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 65/100
rescript-lang/rescript#8765 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[workshop-sim] Improve: Add a required self-check gate to the agentic-workflows concept pageĐang mởfeedback simulation workshop
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
githubnext/gh-aw-workshop#4417 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Good First Issue]: Add unit tests for NetworkVersionInfoCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởGood First Issue hacktoberfest
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
hiero-ledger/hiero-sdk-js#4489 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add: RiC FeedĐang mởcheck:passed feeds:add
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 9 ngày