Skip to content

Keep blank line between mixed list types #983

Open

Description

@fxha

Description

Loose list with different bullet or ordered list delimiter are exported as tight list and/or as mixed list.

Steps to reproduce

Following list(s) are exported as tight list.

- foo
- foo

1. bar
2. bar
<optional new line>
- foo
- foo
- foo
- foo

- [ ] bar
- [ ] bar

Expected:

If one list is a loose list and further lists follow without separation all previous and following lists should be loose until a not list type is parsed. If two or more bullet and task lists follow without separation by not a list type a new line is parsed as loose list indicator. Meaning both examples above are loose lists because a new line is between two lists and none of the lists are separated by a paragraph or other not list type. Whereas the following exampe is a loose + tight list:

The blank line should be retained after parsing and bullet/task lists should be tight by default if not separated while parsing.

Versions


Also see #964 comments.

Activity

  1. added
    🦁 need discuss
    🐸 markdown/spec
    on Apr 27, 2019
  2. Jocs commented on Apr 27, 2019

    @Jocs
    Member

    If one list is a loose list and further lists follow without separation all previous and following lists should be loose until a not list type is parsed.

    Sorry I didn't find this in commonmark Spec?

    And I test the first example in commonmark dingus:

    https://spec.commonmark.org/dingus/?text=-%20foo%0A-%20foo%0A%0A1.%20bar%0A2.%20bar%0A%0A%0A-%20foo%0A-%20foo

  3. fxha commented on Apr 27, 2019

    @fxha
    ContributorAuthor

    Sorry I didn't find this in commonmark Spec?

    It's not specified but according to other examples and after a thorough reading of the list specification the only problem is that the blank lines are not exported.

  4. changed the title [-]Loose list regression[/-] [+]Keep blank line between mixed list types[/+] on Apr 27, 2019
  5. added
    🐛 bug
    and removed
    🦁 need discuss
    on Oct 27, 2026
  6. Jocs commented on Oct 27, 2026

    @Jocs
    Member

    Re-tested both examples from this issue against commit e8c602c using Muya's MarkdownToState → ExportMarkdown pipeline, with listIndentation: 1. This is a source-level engine check, not a packaged desktop UI test.

    1. Bullet / ordered / bullet lists

    Input, with a blank line at each list boundary (rather than the literal <optional new line> placeholder):

    - foo
    - foo
    
    1. bar
    2. bar
    
    - foo
    - foo

    Actual serialized output:

    - foo
    - foo
    1. bar
    2. bar
    - foo
    - foo

    The blank lines between the separate lists are still removed. Re-parsing the output produces the same Muya state as parsing the input: the three lists remain separate and tight. The loss here is the original source spacing, not a change from loose to tight lists.

    2. Plain items followed by task items, with an authored blank line

    Input:

    - foo
    - foo
    
    - [ ] bar
    - [ ] bar

    Actual serialized output:

    - foo
    
    - foo
    
    - [ ] bar
    
    - [ ] bar

    The authored blank line is retained, but serialization adds blank lines between the other items as well. Re-parsing preserves the original Muya state and loose-list semantics; the exact placement of source blank lines is normalized.

    For comparison, the tight mixed input below now round-trips unchanged:

    - foo
    - [ ] bar

    Across six checked cases (the two issue examples, different bullet markers, different ordered delimiters, a different-marker task item, and the tight mixed control), all re-parsed states matched their initial states, and a second serialization was stable. Five cases changed the source whitespace; the tight mixed control did not.

    The remaining behavior demonstrated by the original examples is source-whitespace preservation. The unwanted blank-line insertion into tight same-marker plain/task lists reported in #5257 is no longer reproduced. This distinction is consistent with #5872 leaving exact preservation of the distinct-marker gaps in this issue as separate work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐸 markdown/spec🐛 bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions