docs: fix appending index.html.md to api reference links (#11327)

* docs: fix appending index.html.md to api reference links

* make hash in api reference lower case
This commit is contained in:
Shahed Nasser authored and GitHub committed 2025-02-05 17:29:07 +02:00
1 parent bc53716d8d
commit a655b49a7d
6 files changed
+11314 -11218

No files matched your search

@@ -0,0 +1,18 @@
import { UnistNode, UnistTree } from "types"
import { Transformer } from "unified"
export const changeLinksToHtmlMdPlugin = (): Transformer => {
return async (tree) => {
const { visit } = await import("unist-util-visit")
visit(tree as UnistTree, ["link"], (node: UnistNode) => {
if (
node.type === "link" &&
node.url?.startsWith("https://docs.medusajs.com") &&
!node.url.endsWith("index.html.md")
) {
node.url += `/index.html.md`
}
})
}
}
@@ -1,5 +1,6 @@
export * from "./add-url-to-relative-link.js"
export * from "./broken-link-checker.js"
export * from "./change-links-md.js"
export * from "./cloudinary-img.js"
export * from "./cross-project-links.js"
export * from "./local-links.js"