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:
@@ -145,22 +145,6 @@ const removeFrontmatterPlugin = (): Transformer => {
|
||||
}
|
||||
}
|
||||
|
||||
const changeLinksPlugin = (): 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`
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const getParsedAsString = (file: VFile): string => {
|
||||
let content = file.toString().replaceAll(/^([\s]*)\* /gm, "$1- ")
|
||||
const frontmatter = file.data.matter as FrontMatter | undefined
|
||||
@@ -214,8 +198,6 @@ export const getCleanMd = async ({
|
||||
unifier.use(...(Array.isArray(plugin) ? plugin : [plugin]))
|
||||
})
|
||||
|
||||
unifier.use(changeLinksPlugin)
|
||||
|
||||
const content = type === "file" ? await read(file) : file
|
||||
const parsed = await unifier.process(content)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user