Description
Per the TSDoc spec, @example
comment blocks are intended to treat the first line (the text on the same line as the tag) as the example's "title".
Unfortunately, the formatting information required to differentiate this line from other block contents are not preserved by API-Extractor.
For a TSDoc comment like the following:
/**
* @example Example Title
*
* Example body
*/
The expected api.json contents would look like:
"docComment": "/**@example Example Title\n *\n * Example body\n */\n"
Instead, what is generated looks like the following:
"docComment": "/**@example\n *\n * Example Title\n *\n * Example body\n */\n"
API-Extractor seems to be injecting blank lines between the @example
tag and the contents when none are present.
This makes it impossible for consumers of the api.json files from differentiating @example
comments with titles from those without titles.
Ideally, API-Extractor would not introduce these blank lines.
A sample repro can be found here: https://github.com/Josmithr/api-extractor-playground/tree/example-comment-bug-repro
Standard questions
Please answer these questions to help us investigate your issue more quickly:
Question | Answer |
---|---|
@microsoft/api-extractor version? |
7.47.5 |
Operating system? | Linux |
API Extractor scenario? | |
Would you consider contributing a PR? | Yes |
TypeScript compiler version? | 5.5.2 |
Node.js version (node -v )? |
20.15.1 |
Metadata
Metadata
Assignees
Labels
Type
Projects
Status