typedoc2md / typedoc-plugin-markdown

A plugin for TypeDoc that enables TypeScript API documentation to be generated in Markdown.
https://typedoc-plugin-markdown.org
MIT License
697 stars 173 forks source link

[typedoc-plugin-markdown@next] Bug (Lint MD011): Using indexed access types (may) trigger reversed link syntax rule. #484

Closed sharky98 closed 9 months ago

sharky98 commented 10 months ago

Hello,

This is probably an edge case. I am using indexed access types to obtain the type of an array's element.

Another example of indexing with an arbitrary type is using number to get the type of an array’s elements.

This look like this.

type ArrayOfStuff = {name: string, age: number}[];

type Stuff = ArrayOfStuff[number];

ArrayOfStuff and Stuff have both their own page. As such, a link is made in the resulting markdown. It looks like this.

[`ArrayOfStuff`](ArrayOfStuff.md)[`number`]

However, this syntax triggers the markdownlint rule MD011 about reversed link syntax.

Suggestion

To avoid this, the square brackets coming from the source code could be escaped.

[`ArrayOfStuff`](ArrayOfStuff.md)\[`number`\]

Note: The rule is not triggered when the square brackets are empty, but I see not adverse effect of escaping them also.

tgreyuk commented 10 months ago

Thank you. Fix in typedoc-plugin-markdown@4.0.0-next.24