Fix oversized nested headers in exported HTML/PDF

The remaining "text still looks large" complaint after the page-
geometry fix was real: .message h1-h6 only ever set margin, never
font-size, so any markdown header inside an AI response (very common
in formatted answers — "## Reality Check on Capacity" etc) fell back
to the browser's default heading sizes (h2 ≈ 22px+ against a 15px
body). Gave headers an explicit, compact scale (19/17/15.5/14px) and
trimmed the base body size from 15px to 14px and the outer title from
24px to 22px for a tighter, more document-like feel overall.

Verified by reproducing the exact content from the reported screenshot
(the M1 AI Setup conversation with its "Reality Check on Capacity"
h2 and bolded list items) through the same standalone WKWebView/
createPDF harness used for the previous fix, and visually confirming
the heading now renders proportionately instead of oversized.
This commit is contained in:
2026-07-29 11:51:53 +02:00
parent 3a30db1d15
commit 2219aceda6
+7 -4
View File
@@ -73,16 +73,19 @@ enum ConversationExportService {
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
::-webkit-scrollbar { display: none; }
body { font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif; \
font-size: 15px; color: #1a1a1a; background: #ffffff; max-width: 820px; margin: 40px auto; \
font-size: 14px; color: #1a1a1a; background: #ffffff; max-width: 820px; margin: 40px auto; \
padding: 0 24px; line-height: 1.5; }
h1 { font-size: 24px; border-bottom: 1px solid #ddd; padding-bottom: 12px; }
h1 { font-size: 22px; border-bottom: 1px solid #ddd; padding-bottom: 12px; }
.message { margin: 20px 0; padding: 12px 16px; border-radius: 8px; border-left: 4px solid transparent; }
.message.user { background: #f5f7fa; border-left-color: #4a90d9; }
.message.assistant { background: #fafafa; border-left-color: #8a8a8a; }
.role { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; \
.role { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; \
color: #666; margin-bottom: 8px; }
.message p { margin: 8px 0; }
.message h1, .message h2, .message h3, .message h4, .message h5, .message h6 { margin: 12px 0 6px; }
.message h1 { font-size: 19px; margin: 12px 0 6px; }
.message h2 { font-size: 17px; margin: 12px 0 6px; }
.message h3 { font-size: 15.5px; margin: 12px 0 6px; }
.message h4, .message h5, .message h6 { font-size: 14px; margin: 12px 0 6px; }
.message ul, .message ol { margin: 8px 0; padding-left: 24px; }
.message blockquote { margin: 8px 0; padding: 4px 12px; border-left: 3px solid #ccc; color: #555; }
.message code { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em; \