mirror of
https://github.com/supabase/supabase.git
synced 2026-10-15 06:09:08 +03:00
fix(library): rewrite docs links before applying the markdown schema
Component handlers serialize children to strings, so nested markdown links were no longer visitable once applySchema ran first. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
503a87f7e0
commit
764a2b19b8
2 files changed
+18
-1
No files matched your search
@@ -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
|
||||
---
|
||||
|
||||
<Callout type="note">
|
||||
See the [React client](/library/docs/react/client) before installing.
|
||||
</Callout>
|
||||
`)
|
||||
|
||||
assert.match(
|
||||
output,
|
||||
/Note: See the \[React client\]\(https:\/\/supabase\.com\/library\/docs\/react\/client\.md\) before installing\./
|
||||
)
|
||||
})
|
||||
})
|
||||
@@ -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[] = []
|
||||
|
||||
Reference in new issue
Block a user