fix: fix markdown escape issue

This commit is contained in:
fatelei 2025-12-29 11:55:03 +08:00
parent 8611301722
commit f98d2aaffb
No known key found for this signature in database
GPG Key ID: 2F91DA05646F4EED
1 changed files with 8 additions and 1 deletions

View File

@ -18,12 +18,19 @@ const BasicContent: FC<BasicContentProps> = ({
if (annotation?.logAnnotation)
return <Markdown content={annotation?.logAnnotation.content || ''} />
// Preserve Windows UNC paths and similar backslash-heavy strings by
// wrapping them in inline code so Markdown renders backslashes verbatim.
let displayContent = content
if (typeof content === 'string' && /^\\\\\S.*/.test(content) && !/^`.*`$/.test(content)) {
displayContent = `\`${content}\``
}
return (
<Markdown
className={cn(
item.isError && '!text-[#F04438]',
)}
content={content}
content={displayContent}
/>
)
}