import ReactMarkdown, { type Components } from "react-markdown"; import remarkGfm from "remark-gfm"; /** * Print-styled markdown renderer for the SOP print routes. * * Renders the same markdown shapes as `components/markdown.tsx` but * uses the `.sop-print` class names that map to the print CSS in * globals.css. The screen view is a clean A4-shaped document, the * print output is identical (the .sop-print rules are media-aware). * * Why a separate component instead of reusing Markdown? The * in-app Markdown uses Tailwind utility classes that target the * app's dark/light theming. The print view is its own document; * reusing those classes would mean a screen view that mixes * themes awkwardly. A dedicated renderer keeps each context * clean. */ export function MarkdownPrint({ children }: { children: string }) { return ( {children} ); } const components: Components = { h1: ({ children, ...props }) => (

{children}

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

{children}

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

{children}

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

{children}

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

{children}

), ul: ({ children, ...props }) => ( ), ol: ({ children, ...props }) => (
    {children}
), li: ({ children, ...props }) => (
  • {children}
  • ), a: ({ children, href, ...props }) => ( {children} ), blockquote: ({ children, ...props }) => (
    {children}
    ), hr: (props) =>
    , table: ({ children, ...props }) => ( {children}
    ), thead: ({ children, ...props }) => ( {children} ), tbody: ({ children, ...props }) => ( {children} ), tr: ({ children, ...props }) => {children}, th: ({ children, ...props }) => {children}, td: ({ children, ...props }) => {children}, code: ({ children, className, ...props }) => { const isBlock = typeof className === "string" && className.length > 0; if (isBlock) { return ( {children} ); } return ( {children} ); }, pre: ({ children, ...props }) => (
    {children}
    ), strong: ({ children, ...props }) => ( {children} ), em: ({ children, ...props }) => ( {children} ), input: ({ type, checked, disabled, ...props }) => { if (type === "checkbox") { return ( ); } return ; }, };