Skip to content

Do not insert blank lines between list items #2286

Closed

Description

@mkpaz

It's not a question, neither a bug nor a feature request, but rather undesired/questionable behaviour. Typora has exactly the same issue, please see full explanation here - typora/typora-issues#2278. In short, when code block or paragraph is added to a list, MarkText inserts blank line between each list item no matter that "Preferred loose list item" option is disabled.

I just describe my use case. I use markdown to keep and manage my tasks. I prefer to keep task lists dense (tight), because in that case it's much easer to read, but it's very often when task need an additional explanation.

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

  Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  Aliquam consequat placerat odio,condimentum tristique magna
  accumsan et. Maecenas id felis eu lectus sodales faucibus
  nec ac ex.

- [ ] tick

  - [ ] subtask1
  - [ ] subtask2

- [ ] tock

This is perfectly valid syntax, but when MarkText engine detects that list is loose it inserts additional blank lines between list items, thus making my task list two times bigger.

Activity

  1. trev-dev commented on Jul 19, 2020

    @trev-dev

    I agree with this, only, if it could be a setting, that would be even better. While I prefer no extra white space in lists, some people might prefer them.

  2. ivy-rew commented on Dec 30, 2023

    @ivy-rew
    Contributor

    The seeting seems available today:
    Menu > File > Preferences > Markdown > Untoggle "List: Prefer loose list items"
    Disabling it; I get the "normal" list behavior back, not adding extra new-lines.
    MarkText_002

  3. added
    🐛 bug
    🪲 pri/low
    🦏 list block
    on May 16, 2026
  4. Jocs commented on Jun 22, 2026

    @Jocs
    Member

    Thank you for the detailed report and the Typora comparison!

    The behavior you describe — blank lines inserted between all items of a list once any item contains a multi-paragraph block — is correct per the CommonMark specification, which treats looseness as a whole-list property: if any item is followed by a blank line the entire list is considered loose and every item is rendered/serialized with blank-line separation.

    Since this report was filed, MarkText has added a preference that addresses the common case: Menu → File → Preferences → Markdown → "List: Prefer loose list items". Disabling this option causes newly created lists to default to tight (no blank lines). A contributor confirmed this in the comments in December 2023.

    For existing files that are already parsed as loose (because they contain multi-paragraph items), the loose flag is read directly from the source markdown by the parser, so tight items in the same list will still round-trip with blank-line separation — this is a fundamental constraint of the CommonMark spec, not a MarkText bug.

    Given that the preference setting covers the main use-case and the remaining behavior is spec-mandated, we're closing this issue. If you'd like per-item looseness control as a first-class feature (which would require deviating from the spec), please open a new feature request so it can be tracked separately.

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

    🪲 pri/low🐛 bug🔭 area/muya🦏 list block

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions