rushstack
rushstack copied to clipboard
[api-documenter] Avoid putting markdown/text after an HTML tag
Summary
Sometimes, the generated Markdown has a closing HTML tag followed by text, without any blank lines in-between. This can mess up some Markdown engines, including GitHub and VSCode.
Repro steps
Given the following .d.ts code
/**
* Adds two numbers.
* @param a - The first number.
* @param b - The second number.
* @returns The sum.
*
* @public
*/
export declare function add(a: number, b: number): number;
running
> api-extractor run
> api-documenter markdown
results in
## Parameters
<table><thead><tr><th>
<!-- ... -->
</tbody></table>
**Returns:**
number
The sum.
Since **Returns:** follows immediately after an HTML tag, it is not rendered properly.
VSCode:
Details
This issue appears with pretty much any function with parameters. It can be fixed by adding a blank line.
Relevant issue: https://github.com/microsoft/vscode-markdown-tm-grammar/issues/85
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@microsoft/api-documenter version? |
7.47.9 |
| Operating system? | Windows |
| Documentation target? | Markdown |
| Would you consider contributing a PR? | No |
| TypeScript compiler version? | 5.6.2 |
Node.js version (node -v)? |
22.7.0 |