typedoc2md/typedoc-plugin-markdown

Bug: Protocol-Relative URLs in `typedoc-sidebar.json` when out and docsRoot are the same

Closed this issue · 1 comments

m1rn commented

What package is the bug related to?

typedoc-vitepress-theme

Describe the issue

Description:

There's a bug in the typedoc-vitepress-theme extension when the out and docsRoot configurations are set to the same directory. Specifically, when the following configurations are used:

  • typedoc config: { "out": "./docs/api" }
  • typedoc-vitepress-theme config: { "docsRoot": "./docs/api" }

The resulting typedoc-sidebar.json file generated by typedoc-vitepress-theme contains protocol-relative URLs for links, such as:

"//namespaces/Base/"

This causes an issue in Vitepress where clicking on a link attempts to navigate to http://namespaces/Base/

Expected Behavior:
When the out and docsRoot configurations are the same, the links should be absolute paths relative to the root of the documentation site, like so:

"/namespaces/Base/"

Steps to Reproduce:

  1. Set up typedoc with the configuration: { "out": "./docs/api" }
  2. Set up typedoc-vitepress-theme with the configuration: { "docsRoot": "./docs/api" }
  3. Run the Typedoc generation process.
  4. Check the generated typedoc-sidebar.json file for protocol-relative URLs.
  5. Serve the docs using Vitepress and click on a generated link.

Minimal Reproduction URL:
https://stackblitz.com/edit/stackblitz-starters-jdb3ch?file=package.json

Environment:

  • typedoc version: 0.26.7
  • typedoc-plugin-markdown version: 4.2.8
  • TypeScript version: 5.5.4
  • Node.js version: 5.5.4

TypeDoc configuration

No response

Expected behavior

No response

thanks - should be fixed in typedoc-vitepress-theme@1.0.2