Skip to content

Markdown inserts newline in lists containing codeblock but skips last element #17731

@mzebrak

Description

@mzebrak

Prettier 3.6.2
Playground link

--parser markdown
--trailing-comma es5

Input:

1. A

2. B
   ```bash
   ls
   ```

3. C
   ```bash
   ls
   ```

4. D
   ```bash
   ls
   ```

Output:

1. A

2. B

   ```bash
   ls
   ```

3. C

   ```bash
   ls
   ```

4. D
   ```bash
   ls
   ```

Expected output:

1. A

2. B

   ```bash
   ls
   ```

3. C

   ```bash
   ls
   ```

4. D

   ```bash
   ls
   ```

OR

1. A

2. B
   ```bash
   ls
   ```

3. C
   ```bash
   ls
   ```

4. D
   ```bash
   ls
   ```

Why?

Formatting is inconsistent and may be misinterpreted by other tools. All code blocks should either have a newline before them or none of them should.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy