/** * Shared Markdown renderer for the /docs/api surface. * * Two modes: * - renders Markdown source as styled JSX inside a docs page. * - getMarkdownSource() returns the raw string for the sibling .md route handlers. * * Stripe-inspired typography rules baked in: * - Hedvig serif headlines (font-display) * - Tabular nums on code, monospaced via Geist Mono * - Hairline horizontal rules between top-level sections * - Code blocks: paper-white surface, single-pixel border, no shadow * - Tables: only used by the auto-generated reference; flat hairline rows */ import ReactMarkdown from 'react-markdown' import { cn } from '@/lib/utils' interface DocsMarkdownProps { source: string className?: string } export function DocsMarkdown({ source, className }: DocsMarkdownProps) { return (
(

{children}

), h2: ({ children }) => (

{children}

), h3: ({ children }) => (

{children}

), h4: ({ children }) => (

{children}

), p: ({ children }) => (

{children}

), a: ({ href, children }) => ( {children} ), ul: ({ children }) => (
    {children}
), ol: ({ children }) => (
    {children}
), li: ({ children }) =>
  • {children}
  • , code: ({ className: codeClassName, children, ...props }) => { const isBlock = (codeClassName ?? '').startsWith('language-') if (isBlock) { return ( {children} ) } return ( {children} ) }, pre: ({ children }) => (
                  {children}
                
    ), hr: () =>
    , blockquote: ({ children }) => (
    {children}
    ), strong: ({ children }) => {children}, table: ({ children }) => (
    {children}
    ), thead: ({ children }) => ( {children} ), th: ({ children }) => ( {children} ), td: ({ children }) => {children}, }} > {source}
    ) }