diff --git a/app/globals.css b/app/globals.css index 015d5db..b4ebb18 100644 --- a/app/globals.css +++ b/app/globals.css @@ -628,7 +628,6 @@ header select option { .message.assistant .role { color: var(--green); } .content { - white-space: pre-wrap; word-break: break-word; min-width: 0; } @@ -919,13 +918,25 @@ header select option { } /* ── markdown content ── */ -.content p { margin: 0 0 0.75em; } +.content p, +.content li, +.content blockquote, +.content h1, +.content h2, +.content h3, +.content h4, +.content h5, +.content h6 { + white-space: pre-wrap; +} + +.content p { margin: 0 0 0.55em; } .content p:last-child { margin-bottom: 0; } .content h1, .content h2, .content h3, .content h4, .content h5, .content h6 { color: var(--green); - margin: 1em 0 0.4em; + margin: 0.8em 0 0.3em; font-weight: bold; line-height: 1.3; } @@ -933,14 +944,15 @@ header select option { .content h2 { font-size: 1.15em; } .content h3 { font-size: 1.05em; } -.content ul { margin: 0.5em 0 0.75em 0; padding-left: 1.5em; } -.content ol { margin: 0.5em 0 0.75em 0; padding-left: 2.5em; } -.content li { margin-bottom: 0.2em; } +.content ul { margin: 0.3em 0 0.5em 0; padding-left: 1.5em; } +.content ol { margin: 0.3em 0 0.5em 0; padding-left: 2.5em; } +.content li { margin-bottom: 0.1em; } +.content li > p { margin: 0; } .content blockquote { border-left: 2px solid var(--dim); padding-left: 12px; - margin: 0.5em 0; + margin: 0.35em 0; color: var(--dim); } diff --git a/tests/unit.test.ts b/tests/unit.test.ts index 13c88bd..6a3592d 100644 --- a/tests/unit.test.ts +++ b/tests/unit.test.ts @@ -1033,6 +1033,21 @@ test('mobile header actions move onto their own wrapped row before they overflow ); }); +test('markdown content spacing stays tight around paragraphs and lists', () => { + const cssSource = readFileSync(join(import.meta.dirname, '../app/globals.css'), 'utf8'); + assert.ok( + cssSource.includes('.content {\n word-break: break-word;') && + !cssSource.includes('.content {\n white-space: pre-wrap;'), + 'the outer markdown content wrapper should not preserve raw whitespace between block elements', + ); + assert.ok( + cssSource.includes('.content li > p { margin: 0; }') && + cssSource.includes('.content ul { margin: 0.3em 0 0.5em 0; padding-left: 1.5em; }') && + cssSource.includes('.content ol { margin: 0.3em 0 0.5em 0; padding-left: 2.5em; }'), + 'lists should use tighter margins and remove paragraph spacing inside list items', + ); +}); + // ── settings validation ──────────────────────────────────────────────────────── test('validateSettingsRequest: validates and defaults girlMode and font', () => {