prettier / prettier/prettier

Markdown comment disable next line no blank line

Open
#14,350 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

lang:markdown
Dominant language
JavaScript
Stars
52.3k
Forks
5k
Avg merge
19h 2m
Merged PRs (30d)
117

Description

Prettier automatically adds a blank line before and after a comment in Markdown.
This behavior is ideal until we use a disable next line directive, such as the one from markdownlint: <!-- markdownlint-disable-next-line -->
The directive must not have any blank lines; otherwise, it is useless.

Prettier 2.8.4
Playground link

Input:

<!-- markdownlint-disable-next-line MD041 -->
![logo](./img/logo.png)

Hello World

Output:

<!-- markdownlint-disable-next-line MD041 -->

![logo](./img/logo.png)

Hello World

Expected behavior:
Prettier should detect markdownlint-disable-next-line in the comment and prevent inserting a blank line after it.

<!-- markdownlint-disable-next-line MD041 -->
![logo](./img/logo.png)

Hello World

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the formatting difference in the linked Prettier Playground using the supplied Markdown input. Done means the markdownlint-disable-next-line comment is followed immediately by the image, without an inserted blank line.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, markdown
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.