import React from "react"; import ReactMarkdown from "react-markdown"; interface CustomComponentProps { href: string; children: React.ReactNode; } type CustomComponent = React.ComponentType; interface Props { markdown: string; components?: { a?: CustomComponent; blockquote?: CustomComponent; code?: CustomComponent; del?: CustomComponent; em?: CustomComponent; heading?: CustomComponent; hr?: CustomComponent; image?: CustomComponent; inlineCode?: CustomComponent; link?: CustomComponent; list?: CustomComponent; listItem?: CustomComponent; paragraph?: CustomComponent; strong?: CustomComponent; table?: CustomComponent; tableCell?: CustomComponent; tableHead?: CustomComponent; tableRow?: CustomComponent; }; options?: any; } const HeadingPrimary: CustomComponent = ({ children }) => (

{children}

); const HeadingSecondary: CustomComponent = ({ children }) => (

{children}

); const Paragraph: CustomComponent = ({ children }) =>

{children}

; const OrderedList: CustomComponent = ({ children }) => (
    {children}
); const UnorderedList: CustomComponent = ({ children }) => ( ); const Link: CustomComponent = ({ href, children }) => ( {children} ); export const MarkdownRenderer: React.FC = ({ markdown, options = {} }) => { const customComponents = { h1: HeadingPrimary, h3: HeadingSecondary, p: Paragraph, ol: OrderedList, ul: UnorderedList, a: Link, }; return ( {markdown} ); };