Jupyter engine: a YAML block in the document body is applied by Quarto but printed in the page, and Pandoc's metadata ignores it
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
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, jupyter, markdown, python, yaml
Hướng nghiên cứu
Start by tracing how the Jupyter engine joins notebook cells into the intermediate Markdown; the report identifies a blank line inserted at the cell boundary before the second YAML block but does not name the source file. Compare the generated x.html.md with the Markdown engine control and run the provided reproduction with keep-ipynb and keep-md enabled. Done means the second block is treated consistently as metadata and is not printed in the rendered page.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug description
In a .qmd that uses the Jupyter engine, a second YAML metadata block in the body (written there, or brought in with {{< include >}}) is read by Quarto, so quarto inspect shows its keys applied. But the block is not seen as metadata by Pandoc: doc.meta keeps the first block's value, and the block is printed in the page (an <hr>, then the YAML text, with the last key turned into a setext heading). With engine: markdown the same block is a metadata block and prints nothing.
So the two halves of Quarto disagree about whether the block is metadata, and the document gets the worst of both: Quarto options take the later value, Pandoc metadata and the body take neither.
Reproducible example
x.qmd:
---
title: Second block
lang: en
filters: [dump.lua]
keep-ipynb: true
keep-md: true
jupyter: python3
---
```{python}
print("hello")
```
Text before.
---
lang: fr
---
Text after.
dump.lua:
function Meta(m)
io.stderr:write("META lang=" .. (m.lang and pandoc.utils.stringify(m.lang) or "nil") .. "\n")
end
quarto inspect x.qmd # "lang": "fr"
quarto render x.qmd --to html
Control: the same file with engine: markdown instead of jupyter: python3, and without the code chunk.
| Jupyter | engine: markdown (control) |
|
|---|---|---|
quarto inspect |
"lang": "fr" |
"lang": "fr" |
doc.meta.lang (Lua filter) |
en |
fr |
<html lang=...> |
en |
fr |
| body | <p>Text before.</p><hr><section id="lang-fr" class="level2"><h2>lang: fr</h2><p>Text after.</p></section> |
<p>Text before.</p><p>Text after.</p> |
Expected: the same result as the markdown engine. Either the block is metadata for Pandoc too (doc.meta.lang is fr, nothing printed), or Quarto does not apply it either.
(Without lang: en in the first block, doc.meta.lang is fr in both, because the later block then just adds a key. The block's text is still printed under Jupyter.)
Cause
With keep-ipynb: true and keep-md: true, the intermediate files show it. The notebook that Quarto builds from the .qmd splits the second block across cells:
markdown ['---\n', 'title: Second block\n', ..., 'jupyter: python3\n', '---']
code ['print("hello")']
raw ['Text before.\n', '\n', '---']
markdown ['lang: fr\n', '---\n', '\n', 'Text after.']
and the Markdown written back out (x.html.md) has a blank line after the opening ---:
Text before.
---
lang: fr
---
Text after.
Pandoc only recognises a metadata block when the line after the opening --- is not blank, so this is now a thematic break, a paragraph and a setext heading, which is what the HTML shows. The first block is unaffected because it is handled separately. The blank line is inserted where the cells are joined (the cell boundary falls on the --- line). I have not found the exact line in the source.
Environment
$ quarto --version
1.11.9
$ quarto pandoc --version | head -1
pandoc 3.10
macOS; Jupyter engine with a Python 3 kernel.
- Ngôn ngữ chính
- JavaScript
- Star
- 6.2k
- Fork
- 492
- Merge trung bình
- 13 giờ 51 phút
- Pull request đã merge (30 ngày)
- 82
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
-
accessibility bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
quarto-dev/quarto-cli#15440 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
accessibility bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
quarto-dev/quarto-cli#15439 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
accessibility bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
quarto-dev/quarto-cli#15438 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
quarto-dev/quarto-cli#15431 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Grid column headings are misaligned in HTML websitesCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbootstrap enhancement themes
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
quarto-dev/quarto-cli#15421 · 2 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/quarto-cli
Issue tương tự
-
bug triage needed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Resource]: PersephoneĐang mởresource-submission validation-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
hesreallyhim/awesome-claude-code#3773 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
tabatkins/railroad-diagrams#129 ·
-
web: api() turns a null or object-valued error body into a TypeError or "[object Object]" and loses the statusCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày