From 08a851f902bd484211a843a6b29413d6e4f138f3 Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Thu, 18 Jun 2026 01:00:05 +0300 Subject: [PATCH] fix(markdown): restore paragraph spacing in assistant messages Wire the unused --markdown-paragraph-spacing token to .markdown-content p so adjacent paragraphs no longer collapse into a single visual line (Tailwind preflight had zeroed the default

margins). The renderer wraps each block in a display:contents [data-md-block] element, so the message-level last-child margin nullifiers target the wrapper, not the paragraph. Drop the trailing margin on the last paragraph of the last block directly so messages don't gain extra bottom space. Keep tool-card and reasoning markdown compact. --- CHANGELOG.md | 2 ++ packages/ui/src/index.css | 24 ++++++++++++++++++++++++ packages/ui/src/styles/design-system.css | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42133818..5b63c2d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +- Chat: adjacent paragraphs in assistant messages now render with a visible gap instead of collapsing into a single visual line. Reasoning and tool-card markdown stay compact, and messages don't gain trailing space at the bottom. + ## [1.13.1] - 2026-06-17 - Chat: inline math delimiters no longer incorrectly treat currency amounts like `$50` as LaTeX math expressions — only `$$...$$` display math and `\(...\)` inline math are recognized. diff --git a/packages/ui/src/index.css b/packages/ui/src/index.css index 5515a136..cf573a83 100644 --- a/packages/ui/src/index.css +++ b/packages/ui/src/index.css @@ -938,6 +938,30 @@ html:not(.dark) .chat-scroll { line-height: inherit; } +/* Restore paragraph block spacing inside markdown content. The + --markdown-paragraph-spacing token existed but was never wired, so Tailwind + preflight's zeroed

margins left adjacent paragraphs collapsed into one + visual line. */ +.markdown-content p { + margin: 0 0 var(--markdown-paragraph-spacing) 0; +} + +/* The markdown renderer wraps each block in a display:contents [data-md-block] + element, so the message-level [&_.markdown-content>*:last-child]:mb-0 + nullifiers target the wrapper (where margin is ignored), not the paragraph. + Drop the trailing margin on the last paragraph of the last block directly so + messages don't gain extra space at the bottom. */ +.markdown-content > [data-md-block]:last-child p:last-child { + margin-bottom: 0; +} + +/* Tool cards (code size) and reasoning (meta size, dimmed) are intentionally + compact — keep their paragraphs tight, matching prior behavior. */ +.markdown-content.markdown-tool p, +.markdown-content.markdown-reasoning p { + margin-bottom: 0; +} + /* Tool markdown should render at code size to match tool card typography. */ .markdown-content.markdown-tool { font-size: var(--text-code) !important; diff --git a/packages/ui/src/styles/design-system.css b/packages/ui/src/styles/design-system.css index f2e2cd79..438eaa43 100644 --- a/packages/ui/src/styles/design-system.css +++ b/packages/ui/src/styles/design-system.css @@ -328,7 +328,7 @@ --markdown-blockquote-border: var(--markdown-blockquote-border); /* Markdown spacing defaults */ - --markdown-paragraph-spacing: 0.35rem; + --markdown-paragraph-spacing: 0.75rem; --markdown-heading-primary-top: 0.75rem; --markdown-heading-primary-bottom: 0.35rem; --markdown-heading-secondary-top: 0.6rem;