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
689 stars 172 forks source link

Generates Filenames with special chars #611

Closed Apollon77 closed 1 month ago

Apollon77 commented 1 month ago

What package is the bug related to?

typedoc-plugin-markdown

Describe the issue

I used the 4.0.1 on https://github.com/project-chip/matter.js with the updated config in https://github.com/project-chip/matter.js/pull/875 and got this warning:

Some of the file names contain characters that are not allowed on Windows: 'TlvObject"'. If you commit, it might not be possible to check out the Git repository on Windows.

So it seems he used double quotes in a filename ... in fact I locally then found various files in a directory called " in the namespaces directory

find . -name '"*' ./docs/matter-node-ble.js/-internal-/namespaces/" ./docs/matter-node.js/exports/cluster/-internal-/namespaces/" ./docs/matter-node.js/exports/certificate/-internal-/namespaces/" ./docs/matter-node.js/exports/datatype/-internal-/namespaces/" ./docs/matter-node.js/exports/schema/-internal-/namespaces/"

After that also lookin in the error sof process if found eg

[warning] Failed to resolve link to "MatterSpecification.v10.Core" in comment for ."/Users/ingof/Dev/GitHub/official-matter.js/packages/matter.js/dist/esm/tlv/TlvObject".ObjectSchema.

Something is wrong here and he created a "full path" directory somehow.

The repo told above is a public one, so you can easiely test yourself

TypeDoc configuration

see https://github.com/project-chip/matter.js/pull/875

basically:

"typedocOptions": { "entryPoints": [...], "plugin": ["typedoc-plugin-missing-exports", "typedoc-plugin-markdown"], "excludeExternals": true, "parametersFormat": "table", "membersWithOwnFile": ["Class", "Enum", "Interface"], "out": "..." }

Expected behavior

No invalid paths/filenames are generated

tgreyuk commented 1 month ago

Thanks.

So its included a fullpath in the name because the symbol represents a module that's been imported from the local file system. This is actually the typescript symbol name created when converting the project. Now there is a bug here (which will be fixed) but the fix will be to normalize the name so it doesn't try to create a weird file path.

If you don't want the fullpath in the module name what you can do is to override the module name as follows:

packages/matter.js/src/tlv/TlvObject.ts

Screenshot 2024-05-10 at 14 54 57

Apollon77 commented 1 month ago

Hm ... Why this was no issue before 4.0? How to achieve the same result as in 3.x?

tgreyuk commented 1 month ago

Hm ... Why this was no issue before 4.0? How to achieve the same result as in 3.x?

The module name is not a new issue (see output from v3). This is the resolved name from the ts compiler and also what you will see in the default html theme.

Screenshot 2024-05-10 at 16 50 45

As I say - there will be a fix to the file paths coming shortly.

tgreyuk commented 1 month ago

Fix to file paths is available in typedoc-plugin-markdown@4.0.2. As previouslly mentioned the file path in the symbol name is not coming from this plugin.

Apollon77 commented 1 month ago

Ok, thank you! I will verify soon