Skip to content

Commit

Permalink
fix(core): fix missing slash when public path is prefixed with http (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed Sep 22, 2024
1 parent e64a6ef commit a7e4775
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/six-spiders-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'typedoc-plugin-markdown': patch
---

- Fix missing slash when public path is prefixed with http (#688)
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ export class MarkdownThemeContext {
const publicPath = this.options.getValue('publicPath');

if (publicPath && !ignorePublicPath) {
return encodeURI(path.join(publicPath, url).replace(/\\/g, '/'));
return encodeURI(`${publicPath.replace(/\/$/, '')}/${url}`).replace(
/\\/g,
'/',
);
}

const baseUrl = path.relative(
Expand Down
2 changes: 1 addition & 1 deletion packages/typedoc-plugin-markdown/test/fixtures/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ const config: Record<string, Fixture> = {
{
useHTMLAnchors: true,
preserveAnchorCasing: true,
publicPath: 'http://example.com',
publicPath: 'https://example.com',
sanitizeComments: true,
flattenOutputFiles: true,
enumMembersFormat: 'htmlTable',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,23 +351,23 @@ exports[`Comments should get tables for properties: (Output File Strategy "membe
## Extends
- [\`BaseClassProperties\`](http:/example.com/Class.BaseClassProperties.md)
- [\`BaseClassProperties\`](https://example.com/Class.BaseClassProperties.md)
## Constructors
<a id="Constructors" name="Constructors"></a>
### new ClassPropertiesTable()
> **new ClassPropertiesTable**(): [\`ClassPropertiesTable\`](http:/example.com/Class.ClassPropertiesTable.md)
> **new ClassPropertiesTable**(): [\`ClassPropertiesTable\`](https://example.com/Class.ClassPropertiesTable.md)
#### Returns
[\`ClassPropertiesTable\`](http:/example.com/Class.ClassPropertiesTable.md)
[\`ClassPropertiesTable\`](https://example.com/Class.ClassPropertiesTable.md)
#### Inherited from
[\`BaseClassProperties\`](http:/example.com/Class.BaseClassProperties.md).[\`constructor\`](http:/example.com/Class.BaseClassProperties.md#Constructors)
[\`BaseClassProperties\`](https://example.com/Class.BaseClassProperties.md).[\`constructor\`](https://example.com/Class.BaseClassProperties.md#Constructors)
## Properties
Expand Down

0 comments on commit a7e4775

Please sign in to comment.