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
691 stars 171 forks source link

typedoc-plugin-markdown@4.0.0-next.26 replaces the `/` in module names to `_` #497

Closed ocavue closed 8 months ago

ocavue commented 8 months ago

Commit 4d8a5bd1e022103ca624c4c6d95cd85955a7b9cb replaces all the / in module name to _ in this line. I know this is by design, however I quite like the previous behavior.

I have an NPM package called prosekit. This package includes multiple modules like prosekit/extensions/code. Previously typedoc-plugin-markdown generated a prosekit/extensions/code.md file, so the rendered HTML page would be prosekit/extensions/code, which is exactly the import path when people use this package in JS code. Currently typedoc-plugin-markdown generates prosekit_extensions/code.md, and it doesn't match the JS import path anymore.

I'd love to have an option to bring the previous behavior back.

ocavue commented 8 months ago

By the way (not related to this issue directly), if we want to normalize some characters in the output file name, I would prefer - over _. One big usage of Markdown files is to generate HTML files, and - is more often seen than _ in the URL.

For example, https://www.semrush.com/blog/what-is-a-url-slug/ gives some reasons:

Use Hyphens, Not Underscores

The best practice is to use hyphens to separate words in URLs. Search engines may not correctly interpret other separators (like underscores).

Good URL slug: /good-old-fashioned-pancakes Bad URL slug: /good_old_fashioned_pancakes

tgreyuk commented 8 months ago

Apologies this was not the intended behaviour. Initial behaviour restored in 4.0.0-next.27. Agreed on the point about the slugs also - thanks for highlighting that also.

ocavue commented 8 months ago

4.0.0-next.27 works for me. Thanks for your quick fix!