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
713 stars 175 forks source link

Angle brackets for generics are unnecessarily escaped in Docusaurus sidebar #665

Closed fb55 closed 1 month ago

fb55 commented 2 months ago

What package is the bug related to?

docusaurus-plugin-typedoc

Describe the issue

Angle brackets for generics are rendered with a leading backslash in the sidebar of my Docusaurus site. For example, I receive Cheerio\<T\> instead of Cheerio<T> in Cheerio's docs:

Screenshot 2024-08-06 at 18 55 17

TypeDoc configuration

All relevant versions:

{
    "@docusaurus/core": "^3.4.0",
    "@docusaurus/module-type-aliases": "^3.3.2",
    "docusaurus-plugin-typedoc": "^1.0.4",
    "typedoc": "^0.26.5",
    "typedoc-plugin-markdown": "^4.2.3",
    "typescript": "^5.5.4"
}

The specific plugin configuration can be found at https://github.com/cheeriojs/cheerio/blob/ca00ea5cad068f535196d7bd53ef09017275fde4/website/docusaurus.config.js#L219-L256

Expected behavior

The sidebar does not include unnecessary escape characters.

And finally — thanks for the great library!

tgreyuk commented 2 months ago

@fb55 Thanks for this.

As of v1 a manual sidebar is generated that should be consumed into the project. This sidebar would then match your documentation structure rather than file structure.

So in your usecase the sidebar would be structured by categories like this:

Screenshot 2024-08-08 at 21 37 30

This does require a bit of config unfortunately which I have added to the docs https://www.typedoc-plugin-markdown.org/plugins/docusaurus/sidebar#injecting-into-autogenerated-sidebar.

Additionally please update to docusaurus-plugin-typedoc@1.0.5 as I discovered a bug while reviewing this.

I hope this is an acceptable solution but I'd be more than happy to take ideas for improvement.