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
725 stars 177 forks source link

Add option to generate relative links with forward slashes in typedoc-plugin-markdown #639

Closed Xtravaganz closed 4 months ago

Xtravaganz commented 4 months ago

What package is the feature request related to?

typedoc-plugin-markdown

Background

Is your feature request related to a problem? Please describe.

When generating Markdown documentation using typedoc-plugin-markdown, the paths in the links are URL-encoded, which results in backslashes (%5C) instead of forward slashes (/). This can cause issues in environments where backslashes are not interpreted correctly, such as on GitHub Pages or other static site hosts.

Describe the solution you'd like

I would like to request an option in typedoc-plugin-markdown that allows for the generation of relative links with forward slashes instead of URL-encoded backslashes. This could be a configuration option like useForwardSlashesInLinks which, when enabled, ensures all generated links use forward slashes.

Describe alternatives you've considered

Currently, I have to run a post-processing script that searches through the generated Markdown files and replaces %5C with /. While this works, it would be more efficient and user-friendly to have this handled directly by the plugin.


## Typedoc config
{
    "disableSources": true,
    "entryPoints": [
        "./src/api/api.ts",
        "./src/utils/list.ts",
        "./src/utils/transform.ts",
        "./src/constants/interfaces.d.ts"
    ],
    "out": "./dist/docs",
    "plugin": ["typedoc-plugin-markdown"],
    "publicPath": "./",
    "useHTMLAnchors": true
}

Proposed solution

No response

tgreyuk commented 4 months ago

Thanks. This is actually a bug - the default behaviour is to normalize the paths to forward slashes, but urls when publicPath is set doesn't do this. Will go into next release.

tgreyuk commented 4 months ago

Fixed in typedoc-plugin-markdown@4.1.1