Skip to content

Commit 26c0586

Browse files
committed
fix(markdown): 防止 pre 长行撑大 markdown 容器
通过 codeTagProps 设置 white-space: pre-wrap 和 word-break: break-all, 让代码块内长行自动换行,避免撑开容器 Made-with: Cursor
1 parent dbb05f5 commit 26c0586

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

frontend/src/components/common/markdown.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ export function Markdown({ children, allowHtml = false, allowInternalLink = true
262262
language={language}
263263
PreTag="pre"
264264
wrapLines={true}
265+
codeTagProps={{ style: { wordBreak: 'break-all', whiteSpace: 'pre-wrap' } }}
265266
>
266267
{code}
267268
</SyntaxHighlighter>

0 commit comments

Comments
 (0)