Skip to content

qmd writer turns a loose bullet list into a tight one when items contain a nested sublist #174

@rundel

Description

@rundel

A BulletList parsed as loose (each item's first block is Paragraph) round-trips as tight (Plain) when at least one item contains a nested sublist. The writer emits blank-line separators between top-level items but the re-parser does not treat the resulting source as loose, so the outer list collapses. Symptom: items[[i]][[1]]$tag = "Plain" after the round trip where the original was "Paragraph".

$ printf -- '-   a\n\n    -   c\n    -   d\n\n-   b\n' 
-   a

    -   c
    -   d

-   b

$ printf -- '-   a\n\n    -   c\n    -   d\n\n-   b\n' | cargo run --bin pampa --
[ BulletList [[Para [Str "a"], BulletList [[Plain [Str "c"]], [Plain [Str "d"]]]], [Para [Str "b"]]] ]

$ printf -- '-   a\n\n    -   c\n    -   d\n\n-   b\n' | cargo run --bin pampa -- -t qmd
* a
  
  * c
  * d

* b

$ printf -- '-   a\n\n    -   c\n    -   d\n\n-   b\n' | cargo run --bin pampa -- -t qmd | cargo run --bin pampa --
[ BulletList [[Plain [Str "a"], BulletList [[Plain [Str "c"]], [Plain [Str "d"]]]], [Plain [Str "b"]]] ]

Examples in 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