import React from 'react'; import { ACCENT, INK, INK_2, INK_3, INK_4, INK_SOFT, INK_FAINT, HAIRLINE } from './theme'; import { parseClause } from './structureClauses'; const bodyText: React.CSSProperties = { lineHeight: 1.7, color: INK_2, fontSize: '0.95rem', margin: 0, }; /** * Body paragraph renderer. A clause paragraph ("133.4.a. …") gets its rule * number hung in a fixed left column and indented by nesting depth; an * "Example:" note becomes a muted callout. Everything else is a plain paragraph. */ function Paragraph({ children }: React.ComponentPropsWithoutRef<'p'>) { const arr = React.Children.toArray(children); const first = arr[0]; if (typeof first === 'string') { // Example callout const ex = first.match(/^Example:\s*/); if (ex) { const body = [first.slice(ex[0].length), ...arr.slice(1)]; return (
Example {body}
); } // Numbered clause: hang the number, indent by depth. const parsed = parseClause(first); if (parsed) { const { num, depth, rest } = parsed; const isTop = depth === 1; return (
{num}.

{rest ? [rest, ...arr.slice(1)] : arr.slice(1)}

); } } return

{children}

; } /** Styled element overrides passed to for the rulebook. */ export const mdComponents = { h1: ({ children, ...props }: React.ComponentPropsWithoutRef<'h1'>) => (

{children}

), h2: ({ children, ...props }: React.ComponentPropsWithoutRef<'h2'>) => (

{children}

), h3: ({ children, ...props }: React.ComponentPropsWithoutRef<'h3'>) => (

{children}

), p: Paragraph, ul: ({ children, ...props }: React.ComponentPropsWithoutRef<'ul'>) => ( ), ol: ({ children, ...props }: React.ComponentPropsWithoutRef<'ol'>) => (
    {children}
), li: ({ children, ...props }: React.ComponentPropsWithoutRef<'li'>) => (
  • {children}
  • ), strong: ({ children, ...props }: React.ComponentPropsWithoutRef<'strong'>) => ( {children} ), a: ({ children, ...props }: React.ComponentPropsWithoutRef<'a'>) => ( {children} ), blockquote: ({ children, ...props }: React.ComponentPropsWithoutRef<'blockquote'>) => (
    {children}
    ), };