Skip to content

qmd writer emits a list-table cell containing multiple blocks as a broken bullet item #183

@rundel

Description

@rundel

The following seems similar / related to #174 & #180 but seems to have some additional issues due to the Table bit.

A .list-table div is parsed by pampa as a real Table. When a cell holds more than one block (e.g. a Para followed by a CodeBlock), the writer emits the cell as a nested bullet item with an empty leading line and the block content indented underneath: - \n text\n \`\`\`...\`\`\`. The reader cannot parse this shape and the generated qmd fails to re-parse.

$ printf '::: {.list-table}\n- - foo\n  - Add values:\n\n    ```python\n    x\n    ```\n:::\n'
::: {.list-table}
- - foo
  - Add values:

    ```python
    x
    ```
:::

$ printf '::: {.list-table}\n- - foo\n  - Add values:\n\n    ```python\n    x\n    ```\n:::\n' | cargo run --bin pampa --
[ Table ( "" , [] , [] ) (Caption Nothing []) [(AlignDefault, ColWidthDefault), (AlignDefault, ColWidthDefault)] (TableHead ( "" , [] , [] ) []) [TableBody ( "" , [] , [] ) (RowHeadColumns 0) [] [Row ( "" , [] , [] ) [Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) [Para [Str "foo"]] , Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) [Para [Str "Add", Space, Str "values:"], CodeBlock ( "" , ["python"] , [] ) "x"] ] ]] (TableFoot ( "" , [] , [] ) [] ) ]

$ printf '::: {.list-table}\n- - foo\n  - Add values:\n\n    ```python\n    x\n    ```\n:::\n' | cargo run --bin pampa -- -t qmd
::: {.list-table}

* - foo
  - 
    Add values:
    ```python
    x
    ```
:::

$ printf '::: {.list-table}\n- - foo\n  - Add values:\n\n    ```python\n    x\n    ```\n:::\n' | cargo run --bin pampa -- -t qmd | cargo run --bin pampa --
Error: Parse error  (line 5, col 5 — `Add`)

From quarto-web:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreaders-writersParsing issues, round-trip discrepancies, writer bugs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions