mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
## I have read the CONTRIBUTING.md file. YES ## What kind of change does this PR introduce? Re-add. Reapplies the Multigres Private Alpha docs section removed in #50662, ready to merge once Sugu gives the go-ahead. Do not merge until then. Linear: MUL-1621 (follow-up to MUL-452). ## What is the current behavior? Multigres docs section is down (per #50662): no overview/compatibility pages, no sidebar entry, no features-table row, no "What you get" cards. ## What is the new behavior? Exact reapply of #49020 (with Multigres marked Private Alpha): overview guide at `/docs/guides/database/multigres`, compatibility stub, Database sidebar entry, features-table row, "What you get" cards, and the `ContentListings` optional-`href` support they rely on. Base branch is the revert PR (#50662) so the diff here is legible now; retarget to `master` once #50662 merges. ## Additional context - `pnpm --filter docs exec vitest run lib/content-listings.test.ts` — 22 passed - Blocked on Sugu's go-ahead — `do-not-merge` label applied --------- Co-authored-by: Nik Richers <nik@validmind.ai>
65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
import { withDocsBasePath } from '~/internals/internal-links'
|
|
import type { ContentListingGroup } from '~/lib/content-listings.schema'
|
|
import {
|
|
filterContentListingItems,
|
|
getContentListingById,
|
|
isExternalContentListingHref,
|
|
} from '~/lib/content-listings.utils'
|
|
|
|
import { getInternalLinkBaseUrl } from '../internal-links'
|
|
|
|
const HEADING_MARKDOWN: Record<'h2' | 'h3' | 'h4', string> = {
|
|
h2: '##',
|
|
h3: '###',
|
|
h4: '####',
|
|
}
|
|
|
|
export function serializeContentListingGroupToMarkdown(
|
|
group: ContentListingGroup,
|
|
linkBaseUrl: string
|
|
): string {
|
|
const items = filterContentListingItems(group.items)
|
|
if (!items.length) return ''
|
|
|
|
const lines: string[] = []
|
|
if (group.heading) {
|
|
const level = group.headingLevel ?? 'h2'
|
|
lines.push(`${HEADING_MARKDOWN[level]} ${group.heading}`)
|
|
lines.push('')
|
|
}
|
|
|
|
if (group.description) {
|
|
lines.push(group.description)
|
|
lines.push('')
|
|
}
|
|
|
|
for (const item of items) {
|
|
if (!item.href) {
|
|
lines.push(`- **${item.title}:** ${item.description}`)
|
|
continue
|
|
}
|
|
|
|
const href = isExternalContentListingHref(item.href)
|
|
? item.href
|
|
: `${linkBaseUrl}${withDocsBasePath(item.href)}`
|
|
const description = item.subtitle ? `${item.subtitle}. ${item.description}` : item.description
|
|
lines.push(`- **[${item.title}](${href}):** ${description}`)
|
|
}
|
|
|
|
return lines.join('\n')
|
|
}
|
|
|
|
/**
|
|
* Markdown export handler for `<ContentListings id="..." />`. Looks up the
|
|
* group by id in the same data registry the React component uses.
|
|
*/
|
|
export const ContentListings = ({ props }: { props: Record<string, unknown> }): string => {
|
|
const id = typeof props.id === 'string' ? props.id : ''
|
|
if (!id) return ''
|
|
|
|
const group = getContentListingById(id)
|
|
if (!group) return ''
|
|
|
|
return serializeContentListingGroupToMarkdown(group, getInternalLinkBaseUrl())
|
|
}
|