hosseinmd / prettier-plugin-jsdoc

A Prettier plugin to format JSDoc comments.
MIT License
232 stars 28 forks source link

Markdown tables in `@param` block are replaced with `2@^5!~#sdE!_TABLE` #205

Closed nelsonni closed 1 year ago

nelsonni commented 1 year ago

Input:

/**
 * @param options Options object for setting file system flags (default: `"r"`):
 *
 * | flags   | description                                                                                                    |
 * | ------- | -------------------------------------------------------------------------------------------------------------- |
 * | `"a"`   | Open file for appending. The file is created if it does not exist.                                             |
 * | `"ax"`  | Like `"a"` but fails if the path exists.                                                                       |
 * | `"a+"`  | Open file for reading and appending. The file is created if it does not exist.                                 |
 * | `"ax+"` | Like `"a+"` but fails if the path exists.                                                                      |
 * | `"as"`  | Open file for appending in synchronous mode. The file is created if it does not exist.                         |
 * | `"as+"` | Open file for reading and appending in synchronous mode. The file is created if it does not exist.             |
 * | `"r"`   | Open file for reading. An exception occurs if the file does not exist.                                         |
 * | `"r+"`  | Open file for reading and writing. An exception occurs if the file does not exist.                             |
 * | `"rs+"` | Open file for reading and writing in synchronous mode. Instructs the OS to bypass the local file system cache. |
 * | `"w"`   | Open file for writing. The file is created (if it does not exist) or truncated (if it exists).                 |
 * | `"wx"`  | Like `"w"` but fails if the path exists.                                                                       |
 * | `"w+"`  | Open file for reading and writing. The file is created (if it does not exist) or truncated (if it exists).     |
 * | `"wx+"` | Like `"w+"` but fails if the path exists.                                                                      |
 */

Actual result:

/**
 * @param options Options object for setting file system flags (default: `"r"`): 2@^5!~#sdE!_TABLE
 */

Expected result:

Nothing within the table should be formatted. A brief search of issues shows that code blocks and tables are supposed to be ignored:

The 2@^5!~#sdE!_TABLE text that is replacing tables within the @param field appears to come from here: https://github.com/hosseinmd/prettier-plugin-jsdoc/blob/bf40c594cfb4cc3b51e3ef28728ccfeb99e1238c/src/descriptionFormatter.ts#L9

hosseinmd commented 1 year ago

fixed: v1.0.5