Skip to content

Commit

Permalink
Merge pull request #55 from nowscott/development
Browse files Browse the repository at this point in the history
fix:修改代码框的渲染方式
  • Loading branch information
nowscott authored Jul 23, 2024
2 parents 69e0457 + d67f6e4 commit 7638654
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/layout/MessageList.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const MessageList = ({ messages, onDelete }) => {
code: ({ node, inline, className, children, ...props }) => {
const match = /language-(\w+)/.exec(className || '');
const content = String(children).replace(/^\n+/, '').replace(/\n+$/, ''); // 去除开头和结尾的空行
return !inline && match ? (
return match ? (
<CodeBlock language={match[1]} value={content} />
) : (
<code className={`${className} whitespace-pre-wrap break-words`} {...props}>
Expand Down

0 comments on commit 7638654

Please sign in to comment.