Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/ui/theme/content/message-components.css
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,23 @@ thinking-block markdown-block {
overscroll-behavior: contain;
}

/* Compact heading scale for thinking blocks — override the global
markdown-block heading rules which are sized for the message body. */
thinking-block markdown-block h1,
thinking-block markdown-block h2,
thinking-block markdown-block h3 {
font-size: var(--text-sm);
font-weight: 700;
margin: 8px 0 4px;
}
thinking-block markdown-block h4,
thinking-block markdown-block h5,
thinking-block markdown-block h6 {
font-size: var(--text-sm);
font-weight: 600;
margin: 6px 0 3px;
}

/* Added by applyMessageStyleHooks() so we don't depend on utility classes. */
.pi-thinking-label--streaming {
animation-duration: 1.2s;
Expand Down
41 changes: 29 additions & 12 deletions src/ui/theme/content/messages.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,43 +33,60 @@ assistant-message { margin-right: var(--pill-inset); }
}

/* ── Markdown heading scale (sidebar-appropriate) ───────────── */
/*
* IMPORTANT: target `markdown-block h1` (stable custom-element tag), NOT
* `.pi-assistant-body h1` (hook-dependent class).
*
* Tailwind v4's base reset (`@layer base`) sets
* h1,h2,...,h6 { font-size: inherit; font-weight: inherit }
* which strips browser defaults. Our overrides are unlayered so they win
* over the reset, but ONLY if the selector actually matches. The old
* `.pi-assistant-body h1` selector failed whenever the style hook didn't
* run (streaming, DOM structure changes from upstream bumps, timing
* races) — leaving headings at `inherit` with no cap.
*
* Using `markdown-block h1` always matches because `markdown-block` is a
* stable custom element tag in pi-web-ui's light DOM. This also covers
* headings inside thinking blocks and tool cards without needing separate
* overrides (those have their own more-specific rules if needed).
*/

.pi-assistant-body h1 {
markdown-block h1 {
font-size: var(--text-lg);
font-weight: 700;
line-height: 1.3;
margin: 16px 0 8px;
}

.pi-assistant-body h2 {
markdown-block h2 {
font-size: var(--text-md);
font-weight: 700;
line-height: 1.35;
margin: 14px 0 6px;
}

.pi-assistant-body h3 {
markdown-block h3 {
font-size: var(--text-base);
font-weight: 700;
line-height: 1.4;
margin: 12px 0 4px;
}

.pi-assistant-body h4,
.pi-assistant-body h5,
.pi-assistant-body h6 {
markdown-block h4,
markdown-block h5,
markdown-block h6 {
font-size: var(--text-base);
font-weight: 600;
line-height: 1.4;
margin: 10px 0 4px;
}

.pi-assistant-body h1:first-child,
.pi-assistant-body h2:first-child,
.pi-assistant-body h3:first-child,
.pi-assistant-body h4:first-child,
.pi-assistant-body h5:first-child,
.pi-assistant-body h6:first-child {
markdown-block h1:first-child,
markdown-block h2:first-child,
markdown-block h3:first-child,
markdown-block h4:first-child,
markdown-block h5:first-child,
markdown-block h6:first-child {
margin-top: 0;
}

Loading