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

Đang mở
#1,158 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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):

Ngôn ngữ chính
Rust
Star
302
Fork
22
Merge trung bình
5 giờ 2 phút
Pull request đã merge (30 ngày)
213

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của quarto-dev/q2

Tất cả issue của quarto-dev/q2

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.