fix: fix overflow for lists in markdown render (#4720)

* feat: Add support for ordered and unordered lists in ContentDisplay and ChatMessage components to prevent overflow
This commit is contained in:
anovazzi1 2024-11-19 18:28:39 -03:00 committed by GitHub
commit 39cec36641
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View file

@ -155,6 +155,12 @@ export default function ContentDisplay({
pre({ node, ...props }) {
return <>{props.children}</>;
},
ol({ node, ...props }) {
return <ol className="max-w-full">{props.children}</ol>;
},
ul({ node, ...props }) {
return <ul className="max-w-full">{props.children}</ul>;
},
code: ({ node, inline, className, children, ...props }) => {
const match = /language-(\w+)/.exec(className || "");
return !inline ? (

View file

@ -552,6 +552,20 @@ export default function ChatMessage({
</span>
);
},
ol({ node, ...props }) {
return (
<ol className="max-w-full">
{props.children}
</ol>
);
},
ul({ node, ...props }) {
return (
<ul className="max-w-full">
{props.children}
</ul>
);
},
pre({ node, ...props }) {
return <>{props.children}</>;
},