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 <p> 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.
This commit is contained in:
Bohdan Triapitsyn
2026-06-18 01:00:05 +03:00
parent 59ecd86b4b
commit 08a851f902
3 changed files with 27 additions and 1 deletions
+2
View File
@@ -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.
+24
View File
@@ -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 <p> 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;
+1 -1
View File
@@ -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;