Skip to content

Commit

Permalink
fix: same text and url
Browse files Browse the repository at this point in the history
  • Loading branch information
Barbapapazes committed Nov 2, 2023
1 parent fc93fa8 commit bc69724
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions utils/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export function resolveMarkdownRelativeLinks(
if (path.startsWith("http") || path.startsWith("https")) {
return match;
}
// match a link (e.g. [./example](./example), will replace the link, not the text)
if (url) {
return match.replace(`(${path})`, `(${cdnBaseURL}/${path.replace(/^\.\//, "")})`);
}
return match.replace(path, `${cdnBaseURL}/${path.replace(/^\.\//, "")}`);
},
);
Expand Down

0 comments on commit bc69724

Please sign in to comment.