chore: update message loader

This commit is contained in:
steven
2023-03-27 16:21:38 +08:00
parent b79e702b5f
commit ad56250e52
5 changed files with 339 additions and 16 deletions

View File

@ -42,12 +42,12 @@ const MessageView = (props: Props) => {
pre({ node, className, children, ...props }) {
const child = children[0] as ReactElement;
const match = /language-(\w+)/.exec(child.props.className || "");
const language = match ? match[1] : "plain";
const language = match ? match[1] : "text";
return (
<pre className={`${className || ""} p-0 w-full`} {...props}>
<CodeBlock
key={Math.random()}
language={language || "plain"}
language={language || "text"}
value={String(child.props.children).replace(/\n$/, "")}
{...props}
/>