Skip to content

Markdown: newline removed around code block in v3.6.0 #17652

@mikaello

Description

@mikaello

Prettier 3.6.0
Playground link

This behaviour was introduced in #16637

Input:

1. Some text, and code block below, with newline after code block

   ```yaml
   ---
   foo: bar
   ```

   1. Another
   2. List

Output:
Newline after fenced code block is removed:

1. Some text, and code block below, with newline after code block

   ```yaml
   ---
   foo: bar
   ```
   1. Another
   2. List

Expected output:

Newline after code block should not be removed (input should be untouched):

1. Some text, and code block below, with newline after code block

   ```yaml
   ---
   foo: bar
   ```

   1. Another
   2. List

Why?

It is common to have a blank newline around fenced code blocks. This is also in conflict with MD031 for those using markdownlint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:markdownIssues affecting Markdownlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions