Jupyter cell option cap-location writes caption-<fig-cap-location value> class

未关闭 适合新手
#15,281 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
90/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
jupyter, typescript
领域
backend

调研方向

在 src/core/jupyter/jupyter.ts 中检查 kCapLoc 附近的单元格类代码块;issue 指出它在构建 caption 类时读取的是 kFigCapLoc。对比 hooks.R 中对同一选项的处理方式。完成标准是 Jupyter 使用 cap-location 的值作为 .caption-*,并且报告中的示例会生成 .caption-top .fig-cap-location-margin。

由索引模型根据 Issue 内容生成。

描述

bug engines-jupyter

Bug description

For a Jupyter cell, the cap-location cell option adds the class caption-<value of fig-cap-location> to the cell div instead of caption-<value of cap-location>.

The code is in src/core/jupyter/jupyter.ts (the cell-class block, near kCapLoc):

if (typeof cell.options[kCapLoc] === "string") {
  classes.push(`caption-${cell.options[kFigCapLoc]}`);   // reads kFigCapLoc, not kCapLoc
}

The knitr hook in hooks.R does it correctly (paste0("caption-", options[["cap-location"]])), so the two engines disagree for the same option.

Reproduction

I ran this on a stored notebook with quarto render t.ipynb --to html --no-execute -M keep-md:true and read the intermediate markdown. One code cell, with a PNG in its stored output, whose source is:

#| cap-location: top
#| fig-cap-location: margin
plot()

Result:

::: {#cell-0 .cell .caption-margin .fig-cap-location-margin execution_count=1}

Expected .caption-top .fig-cap-location-margin.

With cap-location set and fig-cap-location unset, the code above would produce .caption-undefined. I read that from the code and did not run it.

Other implementations that copied this block carry the same bug.

Environment

A development checkout of quarto-cli (quarto --version reports 99.9.9), macOS, Jupyter engine with stored outputs (--no-execute).

主要语言
JavaScript
星标
6.1k
派生
478
平均合并
17 小时 36 分钟
30 天内合并 PR
139

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

quarto-dev/quarto-cli 的其他 Issue

查看 quarto-dev/quarto-cli 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。