markdown_preview: Fix markdown tasklist not being shown (#53699)

Fixes a regression introduced in #52008

It's because [pulldown-cmark](https://crates.io/crates/pulldown-cmark)
may insert Paragraph between Item and TaskListMarker

example markdown:
```md
- [x] a

- [ ] b

```

before:
<img width="168" height="111" alt="image"
src="https://github.com/user-attachments/assets/e840f171-98ad-4115-943c-0c7fff12c272"
/>

after:
<img width="186" height="126" alt="image"
src="https://github.com/user-attachments/assets/4377c4a2-381d-4ebd-9fbf-7bb69e73d849"
/>

<details>
<summary>ParsedMarkdown</summary>

```rust
ParsedMarkdown {
    source: "- [x] a\n\n- [ ] b\n",
    events: [
        (
            0..17,
            RootStart,
        ),
        (
            0..17,
            Start(
                List(
                    None,
                ),
            ),
        ),
        (
            0..9,
            Start(
                Item,
            ),
        ),
        (
            6..8,
            Start(
                Paragraph,
            ),
        ),
        (
            2..5,
            TaskListMarker(
                true,
            ),
        ),
        (
            6..7,
            Text,
        ),
        (
            6..8,
            End(
                Paragraph,
            ),
        ),
        (
            0..9,
            End(
                Item,
            ),
        ),
        (
            9..17,
            Start(
                Item,
            ),
        ),
        (
            15..17,
            Start(
                Paragraph,
            ),
        ),
        (
            11..14,
            TaskListMarker(
                false,
            ),
        ),
        (
            15..16,
            Text,
        ),
        (
            15..17,
            End(
                Paragraph,
            ),
        ),
        (
            9..17,
             q
        (
            0..17,
            End(
                List(
                    false,
                ),
            ),
        ),
        (
            0..17,
            RootEnd(
                0,
            ),
        ),
    ],
    languages_by_name: {},
    languages_by_path: {},
    root_block_starts: [
        0,
    ],
    html_blocks: {},
    mermaid_diagrams: {},
}
```

</details>

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed markdown tasklist not being shown

---------

Co-authored-by: MrSubidubi <finn@zed.dev>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This commit is contained in:
AdamJedl 2026-10-06 12:53:05 +00:00 • committed by GitHub
parent ef33e891bf
commit fd1e8f04b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

Diff content is not available