import React from "react"; import ReactMarkdown from "react-markdown"; import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; import { coy } from "react-syntax-highlighter/dist/esm/styles/prism"; import remarkGfm from "remark-gfm"; import "./App.css"; const ResponseDisplay = ({ response }) => { const renderContent = (content) => { const codeRegex = /```(.*?)```/gs; const parts = content.split(codeRegex); return parts.map((part, index) => { if (index % 2 === 1) { const language = part.split("\n")[0]; const code = part.replace(`${language}\n`, ""); return ( {code} ); } else { return (

); } }); }; return
{renderContent(response)}
; }; export default ResponseDisplay;