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

オープン 初心者向け
#15,281 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
90/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
jupyter, typescript
領域
backend

調査の方向性

src/core/jupyter/jupyter.tsで、kCapLoc付近のセルクラスブロックを調べてください。issueでは、キャプションクラスの作成時にkFigCapLocを読み取っていると指摘されています。hooks.Rで同じオプションがどのように処理されているか比較してください。Jupyterが.caption-*にcap-locationの値を使い、報告された例で.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分
マージ済み PR(30日)
139

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

quarto-dev/quarto-cli のほかの issue

quarto-dev/quarto-cli の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。