getGuidesMarkdownInternal() — supabase Function Reference
Architecture documentation for the getGuidesMarkdownInternal() function in GuidesMdx.utils.tsx from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD e3f6760d_3d29_5416_665c_9614b409ec69["getGuidesMarkdownInternal()"] 2ba77918_c71f_00b4_2b40_c0b152543573["join()"] e3f6760d_3d29_5416_665c_9614b409ec69 -->|calls| 2ba77918_c71f_00b4_2b40_c0b152543573 1673fedf_e2e8_e78f_d1bc_ea27d0b7b85a["checkGuidePageEnabled()"] e3f6760d_3d29_5416_665c_9614b409ec69 -->|calls| 1673fedf_e2e8_e78f_d1bc_ea27d0b7b85a eb1b33c7_935b_b61a_962a_2e11b76d01bc["fromFs()"] e3f6760d_3d29_5416_665c_9614b409ec69 -->|calls| eb1b33c7_935b_b61a_962a_2e11b76d01bc 0d1f4e6d_023f_d670_ea66_14ed55d7f2fe["unwrap()"] e3f6760d_3d29_5416_665c_9614b409ec69 -->|calls| 0d1f4e6d_023f_d670_ea66_14ed55d7f2fe 1ed78735_5e48_6f4d_c7c0_7d9f2c098ee4["isValidGuideFrontmatter()"] e3f6760d_3d29_5416_665c_9614b409ec69 -->|calls| 1ed78735_5e48_6f4d_c7c0_7d9f2c098ee4 70c06384_8dda_31de_ba22_ce75a80729a6["newEditLink()"] e3f6760d_3d29_5416_665c_9614b409ec69 -->|calls| 70c06384_8dda_31de_ba22_ce75a80729a6 1ee162b1_d232_4846_ef61_0018a3d5f851["error()"] e3f6760d_3d29_5416_665c_9614b409ec69 -->|calls| 1ee162b1_d232_4846_ef61_0018a3d5f851 f0cb3c6d_e823_6f6f_b9a4_ab144fc70aa5["extractMessageFromAnyError()"] e3f6760d_3d29_5416_665c_9614b409ec69 -->|calls| f0cb3c6d_e823_6f6f_b9a4_ab144fc70aa5 style e3f6760d_3d29_5416_665c_9614b409ec69 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/docs/features/docs/GuidesMdx.utils.tsx lines 46–105
const getGuidesMarkdownInternal = async (slug: string[]) => {
const relPath = slug.join(sep).replace(/\/$/, '')
const fullPath = join(GUIDES_DIRECTORY, relPath + '.mdx')
const guidesPath = `/guides/${slug.join('/')}`
/**
* SAFETY CHECK:
* Prevent accessing anything outside of published sections and GUIDES_DIRECTORY
*/
if (
!fullPath.startsWith(GUIDES_DIRECTORY) ||
!PUBLISHED_SECTIONS.some((section) => relPath.startsWith(section))
) {
notFound()
}
/**
* DISABLED PAGE CHECK:
* Check if this page is disabled in the navigation configuration
*/
if (!checkGuidePageEnabled(guidesPath)) {
console.log('Page is disabled: %s', guidesPath)
notFound()
}
try {
const guide = (await GuideModelLoader.fromFs(relative(GUIDES_DIRECTORY, fullPath))).unwrap()
const content = guide.content ?? ''
const meta = guide.metadata ?? {}
if (!isValidGuideFrontmatter(meta)) {
throw Error(`Type of frontmatter is not valid for path: ${fullPath}`)
}
const editLink = newEditLink(
`supabase/supabase/blob/master/apps/docs/content/guides/${relPath}.mdx`
)
return {
pathname: `/guides/${slug.join('/')}` satisfies `/${string}`,
meta,
content,
editLink,
}
} catch (error: unknown) {
if (error instanceof Error && error.cause instanceof FileNotFoundError) {
// Not using console.error because this includes pages that are genuine
// 404s and clutters up the logs
console.log('Could not read Markdown at path: %s', fullPath)
} else {
console.error(
'Error processing Markdown file at path: %s:\n\t%s',
fullPath,
extractMessageFromAnyError(error)
)
Sentry.captureException(error)
}
notFound()
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does getGuidesMarkdownInternal() do?
getGuidesMarkdownInternal() is a function in the supabase codebase.
What does getGuidesMarkdownInternal() call?
getGuidesMarkdownInternal() calls 8 function(s): checkGuidePageEnabled, error, extractMessageFromAnyError, fromFs, isValidGuideFrontmatter, join, newEditLink, unwrap.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free