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}
), ul: ({ children, ...props }) => ({children}), hr: (props) =>
{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 ;
},
};