From e3557fb5e31eaa7b39a12e383ebe1982d5c8975f Mon Sep 17 00:00:00 2001 From: Tanner Linsley Date: Mon, 27 Jul 2026 19:04:39 -0600 Subject: [PATCH] Fix wrapped code line spacing --- src/theme.ts | 2 +- test/themes.test.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/theme.ts b/src/theme.ts index 586d171..1714688 100644 --- a/src/theme.ts +++ b/src/theme.ts @@ -145,7 +145,7 @@ export function createThemeBaseCss(options: ThemeBaseCssOptions = {}) { .th-code-inline { color: var(--th-code-inline); } .th-selector { color: var(--th-selector); } .th-command { color: var(--th-command); } -.th-line { display: block; min-width: max-content; } +.th-line { display: inline-block; min-width: 100%; width: max-content; } ${lineNumbersSelector} code { counter-reset: th-line; } ${lineNumbersSelector} .th-line::before { display: inline-block; diff --git a/test/themes.test.ts b/test/themes.test.ts index 89fec21..c2a9b49 100644 --- a/test/themes.test.ts +++ b/test/themes.test.ts @@ -72,6 +72,12 @@ describe('themes', () => { expect(css).not.toContain('pre.th-code') }) + it('lays out wrapped lines without doubling preserved newlines', () => { + expect(createThemeBaseCss()).toContain( + '.th-line { display: inline-block; min-width: 100%; width: max-content; }', + ) + }) + it('can target a renderer-owned code block', () => { const css = createThemeCss({ codeBlockSelector: '.markdown-renderer pre.tm-code',