diff --git a/utils/markdown.ts b/utils/markdown.ts index 38476c7..6bd4c43 100644 --- a/utils/markdown.ts +++ b/utils/markdown.ts @@ -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(/^\.\//, "")}`); }, );