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:
parent
f1c00750aa
commit
39cec36641
2 changed files with 20 additions and 0 deletions
|
|
@ -155,6 +155,12 @@ export default function ContentDisplay({
|
||||||
pre({ node, ...props }) {
|
pre({ node, ...props }) {
|
||||||
return <>{props.children}</>;
|
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 }) => {
|
code: ({ node, inline, className, children, ...props }) => {
|
||||||
const match = /language-(\w+)/.exec(className || "");
|
const match = /language-(\w+)/.exec(className || "");
|
||||||
return !inline ? (
|
return !inline ? (
|
||||||
|
|
|
||||||
|
|
@ -552,6 +552,20 @@ export default function ChatMessage({
|
||||||
</span>
|
</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 }) {
|
pre({ node, ...props }) {
|
||||||
return <>{props.children}</>;
|
return <>{props.children}</>;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue