A list-table cell holding a paragraph is written tight and re-reads as plain

オープン
#1,158 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
backend

調査の方向性

The issue identifies write_list_table as the writer that loses the distinction between Para and Plain; start by locating that function and comparing its cell separators with list_is_tight and the list writers. Reproduce the round trip with the supplied input using cargo run --bin pampa, then check that the x cell remains Para after writing and reading. No test file is named in the issue.

索引モデルが issue の本文から書いたものです。

説明

Since the CommonMark loose/tight change (370123a8aefb144ea32c8443c2ee0e1b32309e7d, #1098), a list-table row whose cells are separated by a blank line reads with Para cells. write_list_table writes a cell's first Plain and Para identically and never puts a blank line between cells, so the row comes back tight and the Para cell re-reads as Plain. Ordinary bullet lists keep the distinction (list_is_tight), so the loss is specific to the list-table cell writer.

Input:

$ printf -- '::: {.list-table}\n\n* * a\n  * b\n\n* * x\n\n  * ```\n    code\n    ```\n\n:::\n'
::: {.list-table}

* * a
  * b

* * x

  * ```
    code
    ```

:::

Reader (the x cell is a Para):

$ printf -- '...' | cargo run --bin pampa -- 2>&1
[ Table ( "" , [] , [] ) (Caption Nothing []) [(AlignDefault, ColWidthDefault), (AlignDefault, ColWidthDefault)] (TableHead ( "" , [] , [] ) [Row ( "" , [] , [] ) [Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "a"]] , Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "b"]] ] ]) [TableBody ( "" , [] , [] ) (RowHeadColumns 0) [] [Row ( "" , [] , [] ) [Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) [Para [Str "x"]] , Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) [CodeBlock ( "" , [] , [] ) "code"] ] ]] (TableFoot ( "" , [] , [] ) [] ) ]

Writer (no blank line between the x cell and the code cell):

$ printf -- '...' | cargo run --bin pampa -- -t qmd 2>&1
::: {.list-table}

* - a
  - b
* - x
  - ```
    code
    ```
:::

Round trip (the x cell is now Plain):

$ printf -- '...' | cargo run --bin pampa -- -t qmd 2>/dev/null | cargo run --bin pampa -- 2>&1
[ Table ( "" , [] , [] ) (Caption Nothing []) [(AlignDefault, ColWidthDefault), (AlignDefault, ColWidthDefault)] (TableHead ( "" , [] , [] ) [Row ( "" , [] , [] ) [Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "a"]] , Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "b"]] ] ]) [TableBody ( "" , [] , [] ) (RowHeadColumns 0) [] [Row ( "" , [] , [] ) [Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "x"]] , Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) [CodeBlock ( "" , [] , [] ) "code"] ] ]] (TableFoot ( "" , [] , [] ) [] ) ]

The only difference between the two reads:

- Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) [Para [Str "x"]]
+ Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "x"]]

Related: #1098 introduced the looseness rule that exposes this. #1151 fixes a sibling writer round trip from the same change (adjacent lists inside a list item) but only touches write_bulletlist / write_orderedlist and the raw-block separator, not write_list_table, so it does not cover this case. #174 was the same Para to Plain symptom for ordinary bullet lists.

In the wild (quarto-web grid tables with a code-block cell; qmd-syntax-helper convert -r grid-tables turns them into list tables with blank-line-separated cells):

主要言語
Rust
スター
302
フォーク
22
平均マージ
5時間 2分
マージ済み PR(30日)
213

環境構築

はじめの一歩

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

quarto-dev/q2 のほかの issue

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

似ている issue

Rust の issue をもっと見る

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

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