diff --git a/apps/ui-library/scripts/library-mdx-to-markdown.test.ts b/apps/ui-library/scripts/library-mdx-to-markdown.test.ts index ffd7ea24c82..d8de6abd293 100644 --- a/apps/ui-library/scripts/library-mdx-to-markdown.test.ts +++ b/apps/ui-library/scripts/library-mdx-to-markdown.test.ts @@ -78,4 +78,21 @@ See the [React client](/library/docs/react/client). assert.match(output, /https:\/\/supabase\.com\/library\/docs\/react\/client\.md/) }) + + it('rewrites documentation links nested inside components', () => { + const output = transformLibraryMdx(`--- +title: Auth +description: Auth block +--- + + +See the [React client](/library/docs/react/client) before installing. + +`) + + assert.match( + output, + /Note: See the \[React client\]\(https:\/\/supabase\.com\/library\/docs\/react\/client\.md\) before installing\./ + ) + }) }) diff --git a/apps/ui-library/scripts/library-mdx-to-markdown.ts b/apps/ui-library/scripts/library-mdx-to-markdown.ts index 08c35d85b12..352435f4909 100644 --- a/apps/ui-library/scripts/library-mdx-to-markdown.ts +++ b/apps/ui-library/scripts/library-mdx-to-markdown.ts @@ -96,8 +96,8 @@ function rewriteLibraryLinks(tree: Root): void { export function transformLibraryMdx(raw: string): string { const { content, data } = matter(raw) const tree = parseMdx(content) - applySchema(tree, markdownSchema) rewriteLibraryLinks(tree) + applySchema(tree, markdownSchema) const body = serializeMdx(tree).trim() const headerParts: string[] = []