import React from "react"; import { Text, Image as UIImage, Link as UILink, Message, Embed, } from "theme-ui"; import ReactMarkdown from "react-markdown"; function Paragraph(props) { return ; } function Heading({ level, ...props }) { const fontSize = level === 1 ? 5 : level === 2 ? 3 : 1; return ( ); } function Image(props) { return ; } function ListItem(props) { return ; } function Code({ children, value }) { const variant = value.startsWith("Warning:") ? "warning" : ""; return ( {children} ); } function Table({ children }) { return ( {children} ); } function TableHead(props) { return ( tr": { borderBottomWidth: "2px" } }} {...props} /> ); } function TableBody(props) { return ( tr": { borderBottomWidth: "1px" } }} {...props} /> ); } function TableRow({ children }) { return ( {children} ); } function TableCell({ children }) { return ( {children} ); } function Link({ href, children }) { const linkText = children[0].props.value; if (linkText === "embed:") { return ; } else { console.log(href); return {children}; } } function Markdown({ source, assets }) { const renderers = { paragraph: Paragraph, heading: Heading, image: Image, link: Link, listItem: ListItem, inlineCode: Code, table: Table, tableHead: TableHead, tableBody: TableBody, tableRow: TableRow, tableCell: TableCell, }; return ( assets[uri]} /> ); } export default Markdown;