SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
Refactor MarkdownRenderer component for improved styling
Salman-Ahamedecedd2d65817
diff --git a/packages/app/src/react/features/ai-chat/components/markdown-renderer.tsx b/packages/app/src/react/features/ai-chat/components/markdown-renderer.tsxindex 8044d656..1ca09fe1 100644--- a/packages/app/src/react/features/ai-chat/components/markdown-renderer.tsx+++ b/packages/app/src/react/features/ai-chat/components/markdown-renderer.tsx@@ -21,14 +21,6 @@ export const MarkdownRenderer: FC<IMarkdownRendererProps> = ({ message, classNamchildren={message}remarkPlugins={[remarkGfm]}components={{- // Headers with consistent styling- h1: (props) => <h1 style={{ fontWeight: 'bold', fontSize: '2em' }} {...props} />,- h2: (props) => <h2 style={{ fontWeight: 'bold', fontSize: '1.5em' }} {...props} />,- h3: (props) => <h3 style={{ fontWeight: 'bold', fontSize: '1.17em' }} {...props} />,- h4: (props) => <h4 style={{ fontWeight: 'bold', fontSize: '1em' }} {...props} />,- h5: (props) => <h5 style={{ fontWeight: 'bold', fontSize: '0.83em' }} {...props} />,- h6: (props) => <h6 style={{ fontWeight: 'bold', fontSize: '0.67em' }} {...props} />,-// Code blocks and inline codecode({ className, children, ...props }) {const match = /language-(\w+)/.exec(className || '');@@ -57,16 +49,73 @@ export const MarkdownRenderer: FC<IMarkdownRendererProps> = ({ message, classNam);},- // Images with responsive styling- img: (props) => (- <img {...props} className="rounded-xl" style={{ maxWidth: '100%', height: 'auto' }} />- ),+ // Headers with consistent styling+ // h1: (props) => <h1 style={{ fontWeight: 'bold', fontSize: '2em' }} {...props} />,+ // h2: (props) => <h2 style={{ fontWeight: 'bold', fontSize: '1.5em' }} {...props} />,+ // h3: (props) => <h3 style={{ fontWeight: 'bold', fontSize: '1.17em' }} {...props} />,+ // h4: (props) => <h4 style={{ fontWeight: 'bold', fontSize: '1em' }} {...props} />,+ // h5: (props) => <h5 style={{ fontWeight: 'bold', fontSize: '0.83em' }} {...props} />,+ // h6: (props) => <h6 style={{ fontWeight: 'bold', fontSize: '0.67em' }} {...props} />,- // Links with security attributes- a: (props) => <a {...props} target="_blank" rel="noopener noreferrer" />,+ // Headers with consistent styling using Tailwind+ h1: (props) => <h1 className="text-[2em] font-bold" {...props} />,+ h2: (props) => <h2 className="text-[1.5em] font-bold" {...props} />,+ h3: (props) => <h3 className="text-[1.17em] font-bold" {...props} />,+ h4: (props) => <h4 className="text-[1em] font-bold" {...props} />,+ h5: (props) => <h5 className="text-[0.83em] font-bold" {...props} />,+ h6: (props) => <h6 className="text-[0.67em] font-bold" {...props} />,+ // Images with responsive styling+ img: (props) => <img {...props} className="max-w-full h-auto rounded my-4" />,// Paragraphs with proper whitespace handling- p: ({ children }) => <p className="whitespace-pre-wrap">{children}</p>,+ p: (props) => <p className="whitespace-pre-wrap leading-relaxed" {...props} />,+ // Links with color and underline+ a: (props) => (+ <a+ {...props}+ target="_blank"+ rel="noopener noreferrer"+ className="text-blue-600 hover:text-blue-800 underline"+ />+ ),+ // Unordered list with bullets+ ul: (props) => (+ <ul {...props} className="list-disc list-inside space-y-2 leading-relaxed" />+ ),+ // Ordered list with numbers+ ol: (props) => (+ <ol {...props} className="list-decimal list-inside space-y-2 leading-relaxed" />+ ),+ // List items+ li: (props) => <li className="whitespace-pre-wrap leading-relaxed" {...props} />,+ // Blockquote styling+ blockquote: (props) => (+ <blockquote+ {...props}+ className="border-l-4 border-slate-300 pl-4 py-2 mb-4 italic text-slate-700"+ />+ ),++ // Horizontal rule+ hr: (props) => <hr className="my-6 border-t border-slate-300" {...props} />,+ // Strong/bold text+ strong: (props) => <strong className="font-bold" {...props} />,+ // Emphasis/italic text+ em: (props) => <em className="italic" {...props} />,+ // Tables+ table: (props) => (+ <table className="border-collapse border border-slate-300 mb-4 w-full" {...props} />+ ),+ thead: (props) => <thead className="bg-slate-200 font-semibold" {...props} />,+ tbody: (props) => <tbody {...props} />,+ tr: (props) => <tr className="border-b border-slate-300" {...props} />,+ th: (props) => (+ <th+ {...props}+ className="border border-slate-300 px-4 py-2 text-left font-bold bg-slate-200"+ />+ ),+ td: (props) => <td className="border border-slate-300 px-4 py-2" {...props} />,}}/></div>