hosseinmd / prettier-plugin-jsdoc

A Prettier plugin to format JSDoc comments.
MIT License
228 stars 29 forks source link

Blockquotes are incorrectly collapsed into a single paragraph #230

Open sxxov opened 5 months ago

sxxov commented 5 months ago

Summary

Blockquotes are not consistently handled when formatted vs unformatted, & thus when either:

  1. Running prettier twice
  2. Using a tool that runs prettier multiple times (e.g. eslint)

Then, blockquotes within JSDoc comments will be collapsed into a single paragraph.

Repro

https://github.com/sxxov/prettier-plugin-jsdoc--blockquote-repro

The repo contains the test case "Block quote". Running the following command will run prettier twice on the test case:

npm run start

Which will output:

/**
 * > ```js
 * > > A block quote
 * > ```> Turns into> ```js
 * > A block quote
 * > ```
 *
 * Sdssasdassd
 */

instead of:

/**
 * > ```js
 * > > A block quote
 * > ```
 *
 * > Turns into
 *
 * > ```js
 * > A block quote
 * > ```
 *
 * Sdssasdassd
 */