hosseinmd / prettier-plugin-jsdoc

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

Description markdown code blocks labeled `jsx` don't get formatted #137

Closed jaydenseric closed 2 years ago

jaydenseric commented 2 years ago

In demo.mjs, if you have this content:

/**
 * ```js
 * let   a
 * ```
 * 
 * ```jsx
 * let   a
 * ```
 */

After formatting the content formats to this:

/**
 * ```js
 * let a;
 * ```
 *
 * ```jsx
 * let   a
 * ```
 */

As you can see, the JSDoc description markdown code block labeled js gets formatted but the one labeled jsx doesn’t.

If you try that same markdown in a demo.md file, after formatting both the js and jsx labeled code blocks are correctly formatted by Prettier, proving that this Prettier plugin is somehow not recognizing all the labels that Prettier can normally format.

jaydenseric commented 2 years ago

Is it to do with this code missing a few entries?

https://github.com/hosseinmd/prettier-plugin-jsdoc/blob/5474d66c7b8b8117d6a2acfa34fcee0d32c2059e/src/descriptionFormatter.ts#L15-L21

There are actually a lot of other code block labels like css that are not supported by this plugin yet, but supported by normal Prettier in markdown.

hosseinmd commented 2 years ago

Yes that is here.

jaydenseric commented 2 years ago

Is there a reason Prettier can't be used to format the whole descriptions as if they are markdown, and let Prettier handle the formatting of the bullet lists, code blocks etc. itself however it normally does?

hosseinmd commented 2 years ago

We tested before but did not get the right result.

hosseinmd commented 2 years ago

fixed v0.3.27 https://github.com/hosseinmd/prettier-plugin-jsdoc/commit/67274804347e6c19b624c4b6ab125d818a7acf2b

jaydenseric commented 2 years ago

@hosseinmd thanks for the speedy fixes, you're doing a champion job 🙌