diff --git a/docs/docs/api/BalancedPool.md b/docs/docs/api/BalancedPool.md index 183ef523185..a7e5598c800 100644 --- a/docs/docs/api/BalancedPool.md +++ b/docs/docs/api/BalancedPool.md @@ -2,7 +2,7 @@ Extends: `undici.Dispatcher` -A pool of [Pool](Pool.md) instances connected to multiple upstreams. +A pool of [Pool](/docs/docs/api/Pool.md) instances connected to multiple upstreams. Requests are not guaranteed to be dispatched in order of invocation. diff --git a/docs/docs/api/MockClient.md b/docs/docs/api/MockClient.md index ac546913d23..7336d8e15ed 100644 --- a/docs/docs/api/MockClient.md +++ b/docs/docs/api/MockClient.md @@ -2,7 +2,7 @@ Extends: `undici.Client` -A mock client class that implements the same api as [MockPool](MockPool.md). +A mock client class that implements the same api as [MockPool](/docs/docs/api/MockPool.md). ## `new MockClient(origin, [options])` diff --git a/docs/docs/api/Pool.md b/docs/docs/api/Pool.md index 6b08294b61c..5745395f421 100644 --- a/docs/docs/api/Pool.md +++ b/docs/docs/api/Pool.md @@ -2,7 +2,7 @@ Extends: `undici.Dispatcher` -A pool of [Client](Client.md) instances connected to the same upstream target. +A pool of [Client](/docs/docs/api/Client.md) instances connected to the same upstream target. Requests are not guaranteed to be dispatched in order of invocation. diff --git a/docs/docs/api/api-lifecycle.md b/docs/docs/api/api-lifecycle.md index 2e7db25d132..c49445b49fb 100644 --- a/docs/docs/api/api-lifecycle.md +++ b/docs/docs/api/api-lifecycle.md @@ -1,6 +1,6 @@ # Client Lifecycle -An Undici [Client](Client.md) can be best described as a state machine. The following list is a summary of the various state transitions the `Client` will go through in its lifecycle. This document also contains detailed breakdowns of each state. +An Undici [Client](/docs/docs/api/Client.md) can be best described as a state machine. The following list is a summary of the various state transitions the `Client` will go through in its lifecycle. This document also contains detailed breakdowns of each state. > This diagram is not a perfect representation of the undici Client. Since the Client class is not actually implemented as a state-machine, actual execution may deviate slightly from what is described below. Consider this as a general resource for understanding the inner workings of the Undici client rather than some kind of formal specification. @@ -28,7 +28,7 @@ stateDiagram-v2 [*] --> idle idle --> pending : connect idle --> destroyed : destroy/close - + pending --> idle : timeout pending --> destroyed : destroy diff --git a/docs/docs/best-practices/mocking-request.md b/docs/docs/best-practices/mocking-request.md index 69543927444..68831931ae8 100644 --- a/docs/docs/best-practices/mocking-request.md +++ b/docs/docs/best-practices/mocking-request.md @@ -1,6 +1,6 @@ # Mocking Request -Undici has its own mocking [utility](../api/MockAgent.md). It allow us to intercept undici HTTP requests and return mocked values instead. It can be useful for testing purposes. +Undici has its own mocking [utility](/docs/docs/api/MockAgent.md). It allow us to intercept undici HTTP requests and return mocked values instead. It can be useful for testing purposes. Example: @@ -73,7 +73,7 @@ const badRequest = await bankTransfer('1234567890', '100') assert.deepEqual(badRequest, { message: 'bank account not found' }) ``` -Explore other MockAgent functionality [here](../api/MockAgent.md) +Explore other MockAgent functionality [here](/docs/docs/api/MockAgent.md) ## Debug Mock Value diff --git a/docs/docs/best-practices/proxy.md b/docs/docs/best-practices/proxy.md index 5764ff38b3c..8b1a7210e8c 100644 --- a/docs/docs/best-practices/proxy.md +++ b/docs/docs/best-practices/proxy.md @@ -2,7 +2,7 @@ Connecting through a proxy is possible by: -- Using [ProxyAgent](../api/ProxyAgent.md). +- Using [ProxyAgent](/docs/docs/api/ProxyAgent.md). - Configuring `Client` or `Pool` constructor. The proxy url should be passed to the `Client` or `Pool` constructor, while the upstream server url diff --git a/docs/docsify/sidebar.md b/docs/docsify/sidebar.md index ab5216f7570..7d6e2b7d77c 100644 --- a/docs/docsify/sidebar.md +++ b/docs/docsify/sidebar.md @@ -20,7 +20,7 @@ * [MockErrors](/docs/api/MockErrors.md "Undici API - MockErrors") * [API Lifecycle](/docs/api/api-lifecycle.md "Undici API - Lifecycle") * [Diagnostics Channel Support](/docs/api/DiagnosticsChannel.md "Diagnostics Channel Support") - * [Debug](/docs/api/Debug.md.md "Undici API - Debugging Undici") + * [Debug](/docs/api/Debug.md "Undici API - Debugging Undici") * [WebSocket](/docs/api/WebSocket.md "Undici API - WebSocket") * [MIME Type Parsing](/docs/api/ContentType.md "Undici API - MIME Type Parsing") * [CacheStorage](/docs/api/CacheStorage.md "Undici API - CacheStorage") diff --git a/docs/index.html b/docs/index.html index 2e0ecca79f4..f6ebf258e32 100644 --- a/docs/index.html +++ b/docs/index.html @@ -32,7 +32,42 @@ noCompileLinks: [ 'benchmarks/.*' ], - relativePath: true + relativePath: true, + markdown: { + renderer: { + // Mimic markedjs/marked behavior just modify href - https://github.com/markedjs/marked/blob/master/src/Renderer.ts#L178-L191 + link(href, title, text) { + const originalHref = href; + + if (href.startsWith('./')) { + // Use absolute path (e.g. ./docs/api.md => /docs/api.md) if href starts with ./ (e.g. ./api.md) + href = href.slice(1); + } + + // Check for /docs/docs/ in the href and remove duplication it if present + href = href.startsWith('/docs/docs/') ? href.replace('/docs/', '/') : href; + + // Check for /docs/ in the href and remove it if present + if (href.startsWith('/docs/')) { + // ignore paths /docs/api/ and /docs/best-practices/ in /docs/docs directory + if (!/^(\/docs\/(?:api|best-practices))(?:\/|$)/.test(href)) { + href = href.includes('/docs/') ? href.replace('/docs/', '/') : href; + } + } + + let target = ''; + if (originalHref.startsWith('http')) { + // External link - default behavior is to open in a new window + return `${text}`; + } + + title = title ? `title="${title}"` : ''; + let out = `${text}`; + + return out; + }, + }, + }, }