fix(webui): wrap long inline code in plain paragraphs (#6670)

* fix(webui): wrap long inline code in plain paragraphs

Keep long single-line inline code inside top-level paragraphs flowing with surrounding text while preserving consecutive spaces and tabs.

Apply the same whitespace preservation to short inline code in those paragraphs. Lists, quotes, headings, tables, and multiline code blocks retain their existing behavior.

Refs #6662

* test(webui): load code-wrapping renderer lazily

Keep the shared fixture from eagerly loading MarkdownTextRenderer, so history-boundary tests can defer it without blocking page navigation.

Refs #6662
This commit is contained in:
chenz authored and GitHub committed 2026-11-15 19:03:42 +08:00
1 parent 12a86eaa86
commit 2c669935a5
5 files changed
+306 -3

No files matched your search

@@ -559,13 +559,14 @@ export default function MarkdownTextRenderer({
/>
);
}
const widePlainBlock = raw.includes("\n") || raw.length > 120;
if (widePlainBlock) {
const multiline = raw.includes("\n");
if (multiline || raw.length > 120) {
return (
<code
className={cn(
"block min-w-0 max-w-full overflow-x-auto whitespace-pre bg-transparent p-0 font-mono text-code",
"text-inherit",
!multiline && "markdown-wide-inline-code",
cls,
)}
{...props}